# coding=utf-8
import  time
from appium import webdriver
from appium.webdriver.common.multi_action import MultiAction
from appium.webdriver.common.touch_action import TouchAction
import  re
import random
import  math

desired_caps = {}
desired_caps[ 'platformName'] = 'Android'
desired_caps[ 'platfromVersion'] = '5.1'
desired_caps[ 'deviceName'] = '0123456789ABCDEF'
desired_caps[ 'appPackage'] = 'com.southgnss.pnstar'
desired_caps[ 'appActivity'] = 'com.southgnss.egstar.EGStarMainActivity'
desired_caps['unicodeKeyboard'] = True
desired_caps['resetKeyboard'] = True
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)

time.sleep(3)
driver.unlock()
# 获取屏幕的size
size = driver.get_window_size()
# 获取屏幕宽度 width
width = size['width']
# 获取屏幕高度 height
height = size['height']
# 获取屏幕尺寸
screenX = driver.get_window_size()['width']
screenY = driver.get_window_size()['height']
# 缩小操作方法
def screen_pinch():
    firstFinger = TouchAction(driver)
    secondFinger = TouchAction(driver)
    zoom_finger = MultiAction(driver)
    firstFinger.press(x=width * 0.5, y=height * 0.4).wait(800).move_to(x=width * 0.5, y=width * 0.5).wait(800).release()
    secondFinger.press(x=width * 0.5, y=height * 0.6).wait(800).move_to(x=height * 0.5, y=height * 0.5).wait(800).release()
    zoom_finger.add(firstFinger, secondFinger)
    zoom_finger.perform()

# 放大操作方法
def screen_zoom():
    firstFinger = TouchAction(driver)
    secondFinger = TouchAction(driver)
    zoom_finger = MultiAction(driver)
    firstFinger.press(x=width * 0.5, y=height * 0.5).wait(800).move_to(x=width * 0.5, y=height * 0.4).wait(800).release()
    secondFinger.press(x=width * 0.5, y=height * 0.5).wait(800).move_to(x=width * 0.5, y=height * 0.6).wait(800).release()
    zoom_finger.add(firstFinger, secondFinger)
    zoom_finger.perform()

# 执行滑屏操作,向下（下拉）滑动
x1 = width*0.5
y1 = height*0.25
y2 = height*0.8
time.sleep(1)
# print("滑动前")
driver.swipe(x1,y1,x1,y2)
# print("滑动后")
# 增加滑动次数，滑动效果不明显，增加滑动次数
for i in range(1):
    # print("第%d次滑屏"%i)
    time.sleep(3)
    driver.swipe(x1,y1,x1,y2)
time.sleep(1)
# 封装滑动方法
def swipeUp(driver,n = 1):
    '''定义向上滑动方法'''
    # print("定义向上滑动方法")
    x1 = width*0.5
    y1 = height*0.9
    y2 = height*0.25
    time.sleep(1)
    # print("滑动前")
    for i in range(n):
        # print("第%d次滑屏" % i)
        time.sleep(1)
        driver.swipe(x1, y1, x1, y2)
def swipeDown(driver,n = 1):
    '''定义向下滑动方法'''
    # print("定义向下滑动方法")
    x1 = width*0.5
    y1 = height*0.5
    y2 = height*0.8
    time.sleep(3)
    # print("滑动前")
    for i in range(n):
        # print("第%d次滑屏" % i)
        time.sleep(1)
        driver.swipe(x1, y1, x1, y2)
def swipeLeft(driver,n = 1):
    '''定义向左滑动方法'''
    # print("定义向左滑动方法")
    x1 = width*0.8
    x2 = width*0.2
    y1 = height*0.15
    time.sleep(1)
    # print("滑动前")
    for i in range(n):
        # print("第%d次滑屏" % i)
        time.sleep(1)
        driver.swipe(x1, y1, x2, y1)
def swipeRight(driver,n = 2):
    '''定义向右滑动方法'''
    # print("定义？向右滑动方法")
    x1 = width*0.2
    x2 = width*0.8
    y1 = height*0.15
    time.sleep(1)
    # print("滑动前")
    for i in range(n):
        # print("第%d次滑屏" % i)
        time.sleep(3)
        driver.swipe(x1, y1, x2, y1)
def 工程管理():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('项目').click()
    driver.find_element_by_name('工程管理').click()
    data = driver.page_source
    if '多选' in data:
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/linearlayoutCurProject').click()
    if __name__ == '__main__':
        swipeUp(driver)
    driver.find_element_by_id('com.southgnss.pnstar:id/LayoutElvCalcType').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('新建工程').click()
    a = random.randint(1,100)
    driver.find_element_by_class_name('android.widget.EditText').send_keys(a)
    driver.find_element_by_id('com.southgnss.pnstar:id/CheckBoxUseProject').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvApplyProject').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/CheckBoxUseProject').click()
    driver.find_element_by_name('确定').click()
    driver.find_element_by_name('目标椭球').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/LayoutProjectDestEllipsoidMode').click()
    if __name__ == '__main__':
        swipeUp(driver)
        driver.back()
    driver.find_element_by_name('确定').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/ModifyProjectAddProjectiveModeSetting').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutcoordinatesystemaddprojectivemode').click()
    driver.find_element_by_name('高斯投影').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_0').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_1').send_keys('500000')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_2').send_keys('114')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_3').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_4').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_5').send_keys('0')
    driver.find_element_by_name('确定').click()
    driver.find_element_by_name('七参数').click()
    b = driver.page_source
    if 'RX(s)' not in b:
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseSevenParam').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_0').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_1').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_2').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_3').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_4').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_5').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_6').send_keys('0')
    driver.find_element_by_name('确定').click()
    driver.find_element_by_name('四参数').click()
    c = driver.page_source
    if '北偏移' not in c:
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseFourParam').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_0').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_1').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_2').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_3').send_keys('1.0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_4').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_5').send_keys('0')
    driver.find_element_by_name('确定').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/LayoutProjectHeightFittingParam').click()
    d = driver.page_source
    if 'A0' not in d:
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseHeightFittingParam').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_0').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_1').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_2').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_3').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_4').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_5').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_6').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_7').send_keys('0')
    driver.find_element_by_name('确定').click()
    driver.find_element_by_name('确定').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
def 坐标系统设置():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('项目').click()
    driver.find_element_by_name('坐标系统设置').click()
    driver.find_element_by_name('坐标系统库').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    a = random.randint(1,100)
    driver.find_element_by_id('com.southgnss.pnstar:id/ModifyProjectCoordinateSystem').send_keys(a)
    driver.find_element_by_name('目标椭球').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/LayoutProjectDestEllipsoidMode').click()
    if __name__ == '__main__':
      swipeUp(driver)
      time.sleep(1)
      swipeDown(driver)
      swipeDown(driver)
      swipeDown(driver)
      driver.find_element_by_name('BJ54').click()
    driver.find_element_by_name('确定').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/ModifyProjectAddProjectiveModeSetting').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutcoordinatesystemaddprojectivemode').click()
    driver.find_element_by_name('高斯投影').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_0').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_1').send_keys('500000')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_2').send_keys('114')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_3').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_4').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_5').send_keys('0')
    driver.find_element_by_name('确定').click()
    driver.find_element_by_name('七参数').click()
    b = driver.page_source
    if 'RX(s)' not in b:
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseSevenParam').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_0').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_1').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_2').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_3').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_4').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_5').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_6').send_keys('0')
    driver.find_element_by_name('确定').click()
    driver.find_element_by_name('四参数').click()
    c = driver.page_source
    if '北偏移' not in c:
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseFourParam').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_0').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_1').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_2').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_3').send_keys('1.0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_4').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_5').send_keys('0')
    driver.find_element_by_name('确定').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/ModifyProjectCorrectParam').click()
    d = driver.page_source
    if '北偏移' not in d:
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseCorrectionParam').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCaculate').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCorrectValue_0').send_keys('1.0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCorrectValue_1').send_keys('1.0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCorrectValue_2').send_keys('1.0')
    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/LayoutProjectHeightFittingParam').click()
    e = driver.page_source
    if 'A0' not in e:
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseHeightFittingParam').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_0').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_1').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_2').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_3').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_4').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_5').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_6').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_7').send_keys('0')
    driver.find_element_by_name('确定').click()
    P = ['斜面','水准面','水准面+斜面']
    M = 0
    while M < 3:
        driver.find_element_by_id('com.southgnss.pnstar:id/ModifyProjectVerBalanPar').click()
        f = driver.page_source
        if M == 0 and '平差常数' not in f:
            driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseHeightFittingParam').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/ModifyVerbalan').click()
        driver.find_element_by_name(P[M]).click()
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_0').send_keys('1.0')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_1').send_keys('1.0')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_2').send_keys('1.0')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_3').send_keys('1.0')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_4').send_keys('1.0')
        M +=1
        driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
    driver.swipe(500, 800, 500, 400)
    i = 0
    while i < 6:
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewElvCaleType').click()
        i += 1
        if i == 1:
            driver.find_element_by_name('不使用').click()
        elif i == 2:
            driver.find_element_by_name('双线性插值').click()
        elif i == 3:
            driver.find_element_by_name('双二次插值').click()
        elif i == 4:
            driver.find_element_by_name('样条插值').click()
        elif i == 5:
            driver.find_element_by_name('特殊的加权插值').click()
        elif i == 6:
            driver.back()
        page_data = driver.page_source
        if '水准模型文件' in page_data:
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewElvGridModeFileName').click()
            driver.find_element_by_name('*.SGF').click()
            driver.find_element_by_name('*.GGF').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
    driver.find_element_by_name('确定').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
def 坐标系统库():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('项目').click()
    driver.find_element_by_name('坐标系统库').click()
    data = driver.page_source
    if '多选' in data:
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/barNewFile').click()
    a = random.randint(1, 100)
    driver.find_element_by_id('com.southgnss.pnstar:id/ModifyProjectCoordinateSystem').send_keys(a)
    driver.find_element_by_name('目标椭球').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/LayoutProjectDestEllipsoidMode').click()
    if __name__ == '__main__':
        swipeUp(driver)
        driver.back()
    driver.find_element_by_name('确定').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/ModifyProjectAddProjectiveModeSetting').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutcoordinatesystemaddprojectivemode').click()
    driver.find_element_by_name('高斯投影').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_0').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_1').send_keys('500000')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_2').send_keys('114')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_3').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_4').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/EditTextValue_5').send_keys('0')
    driver.find_element_by_name('确定').click()
    driver.find_element_by_name('七参数').click()
    w = driver.page_source
    if 'RX(s)' not in w:
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseSevenParam').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_0').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_1').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_2').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_3').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_4').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_5').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_6').send_keys('0')
    driver.find_element_by_name('确定').click()
    driver.find_element_by_name('四参数').click()
    b = driver.page_source
    if '北偏移' not in b:
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseFourParam').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_0').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_1').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_2').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_3').send_keys('1.0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_4').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewFourValue_5').send_keys('0')
    driver.find_element_by_name('确定').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/LayoutProjectHeightFittingParam').click()
    c = driver.page_source
    if 'A0' not in c:
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseHeightFittingParam').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_0').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_1').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_2').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_3').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_4').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_5').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_6').send_keys('0')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSevenValue_7').send_keys('0')
    driver.find_element_by_name('确定').click()
    if __name__ == '__main__':
        swipeUp(driver)
    q = driver.page_source
    if '保存并应用到当前工程' in q:
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxUseElevation').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxUseElevation').click()
    i = 0
    while i < 6:
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewElvCaleType').click()
        i += 1
        if i == 1:
            driver.find_element_by_name('不使用').click()
        elif i == 2:
            driver.find_element_by_name('双线性插值').click()
        elif i ==3:
            driver.find_element_by_name('双二次插值').click()
        elif i == 4:
            driver.find_element_by_name('样条插值').click()
        elif i == 5:
            driver.find_element_by_name('特殊的加权插值').click()
        elif i == 6:
            driver.back()
        page_data = driver.page_source
        if '水准模型文件' in page_data:
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewElvGridModeFileName').click()
            driver.find_element_by_name('*.SGF').click()
            driver.find_element_by_name('*.GGF').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/LayoutProjectCorrectionParam').click()
    r = driver.page_source
    if '北偏移' not in r:
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseCorrectionParam').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCorrectValue_0').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCorrectValue_1').send_keys('2')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCorrectValue_2').send_keys('3')
    driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCaculate').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
    X = 0
    while X < 2:
        X += 1
        if X == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/LayoutProjectCorrectionParam').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchCoorSysAddIsUseCorrectionParam').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCorrectValue_0').send_keys('1')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCorrectValue_1').send_keys('2')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCorrectValue_2').send_keys('3')
    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btcoorsyssure').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
def 坐标管理库():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('项目').click()
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if  not  page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    i = 0
    while i < 2:
        driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt1')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewCode').send_keys('11')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('23')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('10')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('1')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewSpecifyPointTypeGet').click()
        driver.find_element_by_name('测量点').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkStakeoutPoint').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkStakeoutPoint').click()
        i += 1
        if i == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonSaveCancel').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
    j = 0
    while j < 2:
        driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt2')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewCode').send_keys('2')
        driver.find_element_by_id('com.southgnss.pnstar:id/radioRourceBLH').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_1').send_keys('0.0003602715')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_2').send_keys('109.3050622020')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('82')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewSpecifyPointTypeGet').click()
        driver.find_element_by_name('输入点').click()
        j += 1
        if j == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonSaveCancel').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
    k = 0
    while k < 2:
        driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt3')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewCode').send_keys('3')
        driver.find_element_by_id('com.southgnss.pnstar:id/radioRourceBLH').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_1').send_keys('0.004602705')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_2').send_keys('108.30506022030')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('60')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewSpecifyPointTypeGet').click()
        driver.find_element_by_name('控制点').click()
        k += 1
        if k == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonSaveCancel').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
    Z = 0
    while Z < 2:
        driver.find_element_by_name('Pt1').click()
        driver.find_element_by_name('编辑').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt1')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewCode').send_keys('1')
        page = driver.page_source
        if '天线高' in page:
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_4').send_keys('0')
        Z += 1
        if Z == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonSaveCancel').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
    driver.find_element_by_name('Pt1').click()
    driver.find_element_by_name('查看').click()
    if __name__ == '__main__':
        swipeUp(driver)
        time.sleep(3)
        swipeDown(driver)
        time.sleep(3)
    driver.find_element_by_id('android:id/action_bar_title').click()
    M = 0
    while M < 2:
        M += 1
        driver.find_element_by_name('Pt1').click()
        driver.find_element_by_name('删除').click()
        if M == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    N = 0
    while N < 3:
        TouchAction(driver).press(x=120, y=200).release().perform()
        time.sleep(1)
        if N == 0:
            TouchAction(driver).press(x=120, y=300).release().perform()
        elif N == 1:
            TouchAction(driver).press(x=120, y=380).release().perform()
        elif N == 2:
            TouchAction(driver).press(x=120, y=460).release().perform()
        time.sleep(1)
        driver.find_element_by_id('com.southgnss.pnstar:id/editTextFilter').send_keys('1')
        driver.find_element_by_id('com.southgnss.pnstar:id/imgButtonSearch').click()
        N += 1
    Y = 0
    a = ['全部', '测量点', '输入点', '控制点', '平面坐标', '经纬度坐标']
    while Y < 7:
        driver.find_element_by_id('com.southgnss.pnstar:id/itemSetting').click()
        if Y < 6:
            driver.find_element_by_name(a[Y]).click()
        else:
            driver.back()
        Y += 1
    time.sleep(2)
    driver.find_element_by_id('com.southgnss.pnstar:id/itemDetail').click()
    driver.find_element_by_name('库细节').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/itemDetail').click()
    driver.find_element_by_name('恢复').click()
    driver.find_element_by_name('Pt1').click()
    driver.find_element_by_name('查看').click()
    if __name__ == '__main__':
        swipeUp(driver)
        time.sleep(3)
        swipeDown(driver)
        time.sleep(3)
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('Pt1').click()
    driver.find_element_by_name('恢复').click()
    L = 0
    while L < 2:
        L += 1
        driver.find_element_by_name('Pt2').click()
        driver.find_element_by_name('删除').click()
        if L == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('导入').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    P = 0
    Q = 0
    sum = 0
    while Q < 14:
       driver.find_element_by_name('导出').click()
       driver.find_element_by_id('com.southgnss.pnstar:id/editTextExportFileName').send_keys(Q)
       driver.find_element_by_name('Cass文件(东,北,高)(*.dat)').click()
       if P == 9:
           P = 0
           sum = 1
       if sum == 0:
          TouchAction(driver).press(x=410, y=410 + P*90).release().perform()
       else:
           swipeUp(driver)
           time.sleep(1)
           time.sleep(1)
           if P < 4:
              TouchAction(driver).press(x=410, y=880 + P * 80).release().perform()
           else:
               driver.back()
       if P == 4 and sum == 1:
           driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
       else:
           driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
       P += 1
       Q += 1
    driver.find_element_by_id('android:id/action_bar_title').click()
def 工程设置():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('项目').click()
    driver.find_element_by_name('工程设置').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/edtAntennaHeight').send_keys('1.80')
    driver.find_element_by_id('com.southgnss.pnstar:id/radioStraigh').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/radioOblique').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/radioPole').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/radioSide').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchRealityShowHeight').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btnDetail').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/edtAntennaHeight').send_keys('1.80')
    i = 0
    p = ['radioStraigh', 'radioOblique', 'radioPole', 'radioSide']
    o = ['1.800', '1.825', '1.918', '1.914']
    while i < 4:
        driver.find_element_by_id('com.southgnss.pnstar:id/' + p[i]).click()
        driver.find_element_by_id('com.southgnss.pnstar:id/btnCalculate').click()
        data = driver.find_element_by_id('com.southgnss.pnstar:id/tvCalculateAntennaHeight').text
        if data != o[i]:
            print(p[i] + '错误')
        i += 1
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('存储').click()
    y = 1
    while y < 13:
        if y < 12:
            driver.find_element_by_id('com.southgnss.pnstar:id/radioBtn' + str(y)).click()
        if y == 3:
            driver.find_element_by_id('com.southgnss.pnstar:id/edtSmoothTimes').send_keys('6')
        if y == 5:
            driver.find_element_by_id('com.southgnss.pnstar:id/edtPointInterval').send_keys('2')
            if __name__ == '__main__':
                swipeUp(driver)
            driver.find_element_by_id('com.southgnss.pnstar:id/edtPointCode').send_keys('123')
        page = driver.page_source
        if y == 12:
            if '时间间隔(s)' not in page:
                driver.find_element_by_id('com.southgnss.pnstar:id/switchIsUsePPK').click()
            q = ['5', '10', '20', '30', '60']
            w = 0
            while w < 6:
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutShowTimeInterval').click()
                if w < 5:
                    driver.find_element_by_name(q[w]).click()
                if w > 4:
                    for z in range(1):
                        driver.find_element_by_id('com.southgnss.pnstar:id/pen').click()
                        driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('7')
                        if z == 0:
                            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                        else:
                            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                w += 1
        y += 1
    driver.find_element_by_name('限制').click()
    e = ['0.03', '0.06', '0.1', '1.0', '4.0', '5.0', '10.0', '100.0', '无限制']
    r = 0
    while r < 10:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutCollectConditionHrmsLimit').click()
        if r < 9:
            driver.find_element_by_name(e[r]).click()
        if r == 9:
            driver.find_element_by_id('com.southgnss.pnstar:id/pen').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('3')
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        r += 1
    s = 0
    while s < 10:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutCollectConditionVRMSLimit').click()
        if s < 9:
            driver.find_element_by_name(e[s]).click()
        if s == 9:
            driver.find_element_by_id('com.southgnss.pnstar:id/pen').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('3')
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        s += 1
    t = ['0.5', '1.0', '2.0', '3.0', '4.0', '5.0', '10.0', '100.0', '无限制']
    u = 0
    while u < 10:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutCollectConditionPDOPLimit').click()
        if u < 9:
            driver.find_element_by_name(t[u]).click()
        if u == 9:
            driver.find_element_by_id('com.southgnss.pnstar:id/pen').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('3')
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        u += 1
    a = ['单点解', '差分解', '浮点解', '固定解']
    x = 0
    while x < 4:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutCollectConditionStatusLimit').click()
        driver.find_element_by_name(a[x]).click()
        x += 1
    driver.find_element_by_id('com.southgnss.pnstar:id/edtSatelliteElevationMaskAngle').send_keys('0.0')
    driver.find_element_by_id('com.southgnss.pnstar:id/edtDiffAge').send_keys('10.0')
    driver.find_element_by_id('com.southgnss.pnstar:id/edtDistanceToBaseStation').send_keys('30000.00')
    driver.find_element_by_id('com.southgnss.pnstar:id/edtTimeZone').send_keys('8.0')
    driver.find_element_by_id('com.southgnss.pnstar:id/edtShowSurveyPoint').send_keys('100.0')
    if __name__ == "__main__":
        swipeUp(driver)
    driver.find_element_by_id('com.southgnss.pnstar:id/checkAcquiesce').click()
    driver.find_element_by_name('系统设置').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/switchIsUseScale').click()
    # driver.find_element_by_id('com.southgnss.pnstar:id/switchIsUseZoom').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchScreenKeepOnContent').click()
    v = 0
    while v < 10:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutShowScreenLanguageMode').click()
        TouchAction(driver).press(x=250, y=1010 - 70 * v).release().perform()
        time.sleep(3)
        TouchAction(driver).press(x=250, y=400).release().perform()
        time.sleep(2)
        if __name__ == '__main__':
            swipeLeft(driver)
        time.sleep(3)
        TouchAction(driver).press(x=600, y=200).release().perform()
        v += 1
    driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchImageWatermark').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchUseRTCM1021').click()
    if __name__ == '__main__':
        swipeUp(driver)
    g = ['千米(km)', '米(m)', '分米(dm)', '厘米(cm)', '毫米(mm)']
    h = ['英寸(in)', '英尺(ft)', '码(yd)', '英里(mi)', '海里(nmi)']
    k = ['里', '丈', '尺', '寸']
    l = 0
    while l < 5:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutshowUnitLength').click()
        driver.find_element_by_name('公制').click()
        driver.find_element_by_name(g[l]).click()
        l += 1
    A = 0
    while A < 5:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutshowUnitLength').click()
        driver.find_element_by_name('英制').click()
        driver.find_element_by_name(h[A]).click()
        A += 1
    B = 0
    while B < 4:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutshowUnitLength').click()
        driver.find_element_by_name('市制').click()
        driver.find_element_by_name(k[B]).click()
        B += 1
    C = ['平方千米(km²)', '公顷(ha)', '平方米(m²)']
    D = ['平方英尺(sq.ft)', '英亩(arce)', '平方英里(sq.mi)', '平方海里(sq.nmi)']
    F = 0
    while F < 3:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutshowUnitArea').click()
        driver.find_element_by_name('公制').click()
        driver.find_element_by_name(C[F]).click()
        F += 1
    G = 0
    while G < 4:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutshowUnitArea').click()
        driver.find_element_by_name('英制').click()
        driver.find_element_by_name(D[G]).click()
        G += 1
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutshowUnitArea').click()
    driver.find_element_by_name('市制').click()
    driver.find_element_by_name('亩').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutshowUnitAngle').click()
    driver.find_element_by_name('度(ddd.dddddddd)').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutshowUnitAngle').click()
    driver.find_element_by_name('度分秒(ddd.mmssssss)').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutShortcutKey').click()
    E = 1
    while E < 7:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutShortcutKeySave').click()
        driver.find_element_by_name(str(E)).click()
        E += 1
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutShortcutKeyPre').click()
    driver.find_element_by_name('向左').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutShortcutKeyPre').click()
    driver.find_element_by_name('向上').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutShortcutKeyNext').click()
    driver.find_element_by_name('向右').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutShortcutKeyNext').click()
    driver.find_element_by_name('向下').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutUseLevel').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchUseLevel').click()

    '''连接RTK时才有的气泡校准'''
    # data = driver.page_source
    # if '气泡校准' not in data:
    #     driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchIsAcclivitousEqualize').click()
    # H = 0
    # K = ['layoutLevelBubbleAdjust', 'layoutMagneticAdjust']
    # while H < 2:
    #     driver.find_element_by_id('com.southgnss.pnstar:id/' + K[H]).click()
    #     driver.find_element_by_id('com.southgnss.pnstar:id/btnStartAdjust').click()
    #     driver.find_element_by_id('com.southgnss.pnstar:id/btnCancelAdjust').click()
    #     driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
    #     H += 1
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchSolutionStatesChange').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
    driver.find_element_by_name('工程设置').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
def 定位信息():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/itemGpsInfo').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textInfoBasicStation').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('卫星图').click()
    i = 0
    while i < 2:
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxGps').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxGlanass').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxBd').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxGalileo').click()
        i += 1
    time.sleep(1)
    driver.find_element_by_name('信噪比').click()
    time.sleep(3)
    if __name__ == '__main__':
        screen_zoom()
        screen_pinch()
    driver.find_element_by_name('星表').click()
    if __name__ == '__main__':
        swipeUp(driver)
        swipeDown(driver)
    driver.find_element_by_name('数据').click()
    s = 0
    while s < 2:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutDebugIsShowHex').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutDebugIsStartOrStop').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutDebugIsSave').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutDebugClear').click()
        s += 1
    driver.find_element_by_id('com.southgnss.pnstar:id/editTextDebug').send_keys('123')
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonDebugSend').click()
    p = 0
    while p < 2:
        TouchAction(driver).press(x=700, y=100).release().perform()
        driver.find_element_by_name('方盒子注册').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('123')
        if p == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        p += 1
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
def 工程属性():
    driver.find_element_by_id('com.southgnss.pnstar:id/itemCoordinateSystem').click()
    if __name__ == '__main__':
        swipeUp(driver)
        swipeDown(driver)
    driver.find_element_by_id('android:id/action_bar_title').click()
def 参数文件导入():
    driver.find_element_by_name('参数文件导入').click()
    driver.find_element_by_name('加密参数文件(*.er)').click()
    TouchAction(driver).press(x=300, y=300).release().perform()
    i = [250,300,350]
    x = 0
    while x < 2:
        TouchAction(driver).press(x= i[x], y= i[x+1]).release().perform()
        driver.find_element_by_id('com.southgnss.pnstar:id/tvSelectedFile').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/spinnerFileType').click()
        TouchAction(driver).press(x = 300, y = 300).release().perform()
        driver.find_element_by_id('com.southgnss.pnstar:id/tv_return_root').click()
        for m in range(5):
            if __name__ == '__main__':
                swipeUp(driver)
                time.sleep(1)
        driver.find_element_by_name('工程之星必备数据').click()
        time.sleep(1)
        driver.swipe(300,475,300 , 1010)
        driver.find_element_by_name('加密文件er').click()
        if x == 0:
            driver.find_element_by_name('品管.er').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/edtKey').send_keys('1234')
            driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
            driver.back()
            break
        x += 1
def 成果文件导出():
    driver.find_element_by_name('成果文件导出').click()
    Y = 0
    a = ['全部','测量点','输入点','控制点','平面坐标','经纬度坐标']
    while Y < 7:
        driver.find_element_by_id('com.southgnss.pnstar:id/itemSift').click()
        if Y < 6:
            driver.find_element_by_name(a[Y]).click()
        else:
           driver.back()
        Y += 1
    time.sleep(1)
    P = 0
    Q = 0
    sum = 0
    while Q < 14:
        driver.find_element_by_id('com.southgnss.pnstar:id/editTextExportFileName').send_keys(Q)
        driver.find_element_by_name('Cass文件(东,北,高)(*.dat)').click()
        if P == 9:
            P = 0
            sum = 1
        if sum == 0:
            TouchAction(driver).press(x=410, y=410 + P * 90).release().perform()
        else:
            swipeUp(driver)
            time.sleep(1)
            time.sleep(1)
            if P < 4:
                TouchAction(driver).press(x=410, y=880 + P * 80).release().perform()
            else:
                driver.back()
        if P == 4 and sum == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
        driver.find_element_by_name('成果文件导出').click()
        P += 1
        Q += 1
def 图层设置():
    driver.find_element_by_name('图层设置').click()
    p = ['OSMMap','天地图矢量','天地图影像','GoogleImageMap','GoogleVectorMap','离线底图']
    i = 0
    while i < 6:
        driver.find_element_by_id('com.southgnss.pnstar:id/imageView1').click()
        driver.find_element_by_name(p[i]).click()
        i += 1
    m = 0
    while m < 2:
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxIsShowLayerBackGround').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxVisible').click()
        m += 1
    driver.find_element_by_id('com.southgnss.pnstar:id/customSymbolViewDelegate').click()
    w = 0
    while w < 15:
        w += 1
        driver.find_element_by_id('com.southgnss.pnstar:id/customSymbolViewDelegate').click()
        if w > 11:
            if __name__ == '__main__':
                swipeUp(driver)
        driver.find_element_by_name('点符号' + str(w)).click()
    driver.find_element_by_id('com.southgnss.pnstar:id/switchIsLabel').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/switchIsLabel').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/imageViewShowDetail').click()
    k = ['点名','编码','高程']
    t = 0
    while t < 3:
        driver.find_element_by_id('com.southgnss.pnstar:id/imageView4').click()
        driver.find_element_by_name(k[t]).click()
        t += 1
    y = 0
    while y < 7:
        driver.find_element_by_id('com.southgnss.pnstar:id/ImageView05').click()
        time.sleep(1)
        TouchAction(driver).press(x = 500, y = 430 + 80 * y).release().perform()
        y += 1
    q = ['小','中','大']
    e = 0
    while e < 3:
        driver.find_element_by_id('com.southgnss.pnstar:id/ImageView04').click()
        driver.find_element_by_name(q[e]).click()
        e+= 1
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/barInport').click()
    driver.find_element_by_name('*.shp,*.dxf').click()
    TouchAction(driver).press(x=250, y=300).release().perform()
    driver.find_element_by_id('com.southgnss.pnstar:id/tv_return_root').click()
    if __name__ == '__main__':
        swipeUp(driver)
        swipeUp(driver)
    driver.find_element_by_name('工程之星必备数据').click()
    driver.find_element_by_name('新底图文件').click()
    driver.find_element_by_name('软件园底图.dxf').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
    d = 0
    while d < 2:
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        if d == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        d += 1
    driver.find_element_by_id('android:id/action_bar_title').click()
def 编码集():
    driver.find_element_by_name('编码集').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/edtName').send_keys('林地')
    driver.find_element_by_id('com.southgnss.pnstar:id/edtDescription').send_keys('菜地')
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/edtName').send_keys('林地')
    driver.find_element_by_id('com.southgnss.pnstar:id/edtDescription').send_keys('菜地')
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
def 关于():
    driver.find_element_by_name('关于').click()
    a = driver.page_source
    if '退出当前账号' in a:
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonExit').click()
        driver.find_element_by_name('确定').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textviewUser').click()
    i = 0
    while i < 5:
        if i == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewForRegister').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextUserRgt').send_keys('123')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextPswRgt').send_keys('123')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextPsw02Rgt').send_keys('123')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextPsw03Mobile').send_keys('123')
            driver.find_element_by_id('com.southgnss.pnstar:id/btGetMobileCode').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextPsw04MobileCode').send_keys('123')
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewReturnLogin').click()
        if i == 1:
            t = 0
            while t < 2:
                driver.find_element_by_id('com.southgnss.pnstar:id/TextViewSouthCloudAddress').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys(
                    '120.76.223.87')
                if t == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                t += 1
        if i == 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextUser').send_keys('wangzuojing')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextPsw').send_keys('123456')
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonLogin').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/SynchronizationDatasSetting').click()
            time.sleep(6)
            p = 0
            while p < 2:
                driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchUseSyn').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/switchIsUploadLocation').click()
                p += 1
            driver.find_element_by_id('android:id/action_bar_title').click()
            y = 0
            u = ['linearLayoutRegister', 'layoutUpdateCheckVersion', 'layoutAboutSystemFeedBack','layoutSystemHelp',
                 'layoutSystemAutomaticBackup', 'layoutAboutSystem']
            while y < 6:
                driver.find_element_by_id('com.southgnss.pnstar:id/' + u[y]).click()
                if y == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/textviewCopy').click()
                    driver.back()
                    driver.find_element_by_id('com.southgnss.pnstar:id/TextViewFile').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextRegisterSn').send_keys('123456')
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonScan').click()
                    driver.back()
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonOnlineActivation').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonRegister').click()
                    if __name__ == '__main__':
                        swipeUp(driver)
                        swipeDown(driver)
                    driver.find_element_by_id('android:id/action_bar_title').click()
                if y == 2:
                    q = 0
                    e = ['ImageView01', 'imageView2']
                    while q < 2:
                        time.sleep(1)
                        driver.find_element_by_id('com.southgnss.pnstar:id/' + e[q]).click()
                        time.sleep(2)
                        driver.back()
                        q += 1
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextFeedBackDescription').send_keys(
                        '实现hi大大苏打')
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextFeedBackContract').send_keys(
                        '1448867211')
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonSendFeedBack').click()
                if y == 5:
                    driver.back()
                y += 1
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonExit').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonExit').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
            driver.back()
        i += 1
def 设备连接():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    i = 0
    p = ['蓝牙', '内置GPS', '串口', 'WLAN', '演示模式']
    while i < 5:
        driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
        driver.find_element_by_name(p[i]).click()
        if i == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueSearch').click()
            time.sleep(8)
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueStopSearch').click()
            data = driver.page_source
            if 'SG1197133311873' in data:
                driver.find_element_by_name('SG1197133311873').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
                time.sleep(15)
                a = driver.page_source
                if '设备连接' in a:
                    driver.find_element_by_name('设备连接').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueClean').click()
            e = ['South', 'South(S82T/S86T)', '极光S1']
            k = 0
            while k < 3:
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutDeviceTypeSelect').click()
                driver.find_element_by_name(e[k]).click()
                k += 1
        if i == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
            driver.back()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
        if i == 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/linearLayoutEquipmenList').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/linearLayoutEquipmenList').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
        if i == 3:
            driver.find_element_by_id('com.southgnss.pnstar:id/linearLayoutEquipmenList').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSearchWifi').click()
            w = 0
            while w < 2:
                driver.find_element_by_id('com.southgnss.pnstar:id/itemWifiAdd').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextIp').send_keys('10.1.1.1')
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextPort').send_keys('65432')
                if w == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                w += 1
            driver.find_element_by_id('com.southgnss.pnstar:id/itemWifiSystemSetting').click()
            driver.back()
            driver.find_element_by_id('android:id/action_bar_title').click()
            page = driver.page_source
            if '高级设置' in page:
                driver.find_element_by_name('设备连接').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
        if i == 4:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
            t = 0
            while t < 2:
                if t == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/radioRourceBLH').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_1').send_keys(
                        '23.1')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_2').send_keys(
                        '113.2')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys(
                        '45')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_4').send_keys(
                        '0.0')
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/radioRourceNEH').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('2544580.987')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('500008.465')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys(
                        '44.588')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_4').send_keys(
                        '0.0')
                t += 1
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutCurrentCoordinate').click()
            driver.find_element_by_name('Pt1').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
        if i == 5:
            driver.find_element_by_id('com.southgnss.pnstar:id/itemSetting').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsStart').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsStart').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsStartBluetoothConnect').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsStartBluetoothConnect').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewUser').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsStartBinding').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsStartBinding').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsStartUploading').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsStartUploading').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsSend').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsSend').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutCloudService').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/checkApprove').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsServiceOpen').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsServiceOpen').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonConnect').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonDisConnect').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonDisConnect').click()
            driver.find_element_by_id('android:id/action_bar_title').click()
            driver.find_element_by_id('android:id/action_bar_title').click()
        i += 1
    driver.find_element_by_id('android:id/action_bar_title').click()
def 移动站():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.page_source
    if data == ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
        driver.find_element_by_name('蓝牙').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueSearch').click()
        time.sleep(8)
        driver.back()
        if 'SG1197133311873' in data:
            driver.find_element_by_name('SG1197133311873').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
            time.sleep(15)
    else:
        driver.back()
    time.sleep(3)
    driver.find_element_by_name('移动站').click()
    p = driver.page_source
    if '是否切换移动站?' in p:
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    time.sleep(3)
    t = 0
    a = random.randint(1, 100)
    r = ['不使用','接收机移动网络','内置电台','外置电台','手机网络','接收机WIFI网络','星链']
    x = ['NTRIP(移动站模式)', 'EAGLE(网络/电台1+1模式)', 'TCPIP(网络连接模式)']
    G = ['NTRIP(移动站模式)','TCPIP(网络连接模式)']
    A = ['内置电台路由', '外置电台路由', '关闭电台路由']
    while t < 7:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkDataLink').click()
        driver.find_element_by_name(r[t]).click()
        time.sleep(2)
        if t == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfig').click()
            e = 0
            while e < 4:
                if e < 2:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonAdd').click()
                else:
                    TouchAction(driver).press(x=250, y=200).release().perform()
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonEdit').click()
                if e > 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigServerSelect').click()
                    driver.find_element_by_name('219.135.151.189:2018').click()
                    if e < 2:
                        driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingRtkNetConfigNameContent').send_keys(a)
                    else:
                        driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingRtkNetConfigNameContent').send_keys(a)
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingRtkNetConfigIpContent').send_keys('172.16.10.74')
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingRtkNetConfigPortContent').send_keys('2018')
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingRtkNetConfigUserContent').send_keys('0501')
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingRtkNetConfigPasswordContent').send_keys('0502')
                    if e < 2:
                        driver.find_element_by_id('com.southgnss.pnstar:id/checkboxPSW').click()
                        driver.find_element_by_id('com.southgnss.pnstar:id/checkboxPSW').click()
                    for m in range(3):
                        driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigMode').click()
                        driver.find_element_by_name(x[m]).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigAcceptPoint').click()
                if e == 1 or e == 3:
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('123')
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigApn').click()
                if e == 1 or e == 3:
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextApnConfigServer').send_keys('CMNET')
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextApnConfigUser').send_keys('CARD')
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextApnConfigPasswd').send_keys('CARD')
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                if e == 0 or e == 2:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonGetFormRTK').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonCancel').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonSure').click()
                e += 1
            v = ['自动','移动/联通2G','联通3G','移动/联通/电信4G','移动3G','电信2/3G']
            l = 0
            while l < 6:
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutNetWorkConnectType').click()
                driver.find_element_by_name(v[l]).click()
                l += 1
            TouchAction(driver).press(x=250, y=200).release().perform()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonRemove').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonRemove').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonConnect').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonDisConnect').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonSure').click()
            for B in range(3):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutRadioRouteMode').click()
                driver.find_element_by_name(A[B]).click()
        if t == 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfig').click()
            for OP in range(100):
                OP = driver.find_element_by_id( 'com.southgnss.pnstar:id/editTextSettingRtkNetConfigINRSGalleryContent').text
                if OP != '1':
                    driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigINRSGallery').click()
                    if __name__ == '__main__':
                        for wi in range(5):
                            swipeDown(driver)
                    time.sleep(1)
                    TouchAction(driver).press(x=250, y=200).release().perform()
                    time.sleep(1)
                else:
                    break
            for y in range(1,121):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigINRSGallery').click()
                time.sleep(1)
                driver.find_element_by_name(str(y)).click()
            E = ['低档','中档','高档']
            for l in range(3):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigINRSPower').click()
                driver.find_element_by_name(E[l]).click()
            R = ['9600','19200']
            for x in range(2):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigINRSAirBaud').click()
                driver.find_element_by_name(R[x]).click()
            T = ['TRIMTALK','SOUTH','HUACE','SOUTH+','SOUTHX','SATEL','HI-TARGET']
            for h in range(7):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigINRSDeal').click()
                driver.find_element_by_name(T[h]).click()
            driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchRadioRepeater').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigINRSFrequencyMore').click()
            S = ['1-20','21-40','41-60','61-80','81-100','101-120']
            for T in range(5):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigINRSFrequencyMore').click()
                driver.find_element_by_name(S[T]).click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigINRSFrequencyMore').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
            driver.back()
            driver.back()
        if t == 4:
            e = 0
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfig').click()
            while e < 2:
                driver.find_element_by_id('com.southgnss.pnstar:id/buttonAdd').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigServerSelect').click()
                driver.find_element_by_name('219.135.151.189:2018').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingRtkNetConfigNameContent').send_keys(
                    a)
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingRtkNetConfigIpContent').send_keys(
                    '172.16.10.74')
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingRtkNetConfigPortContent').send_keys(
                    '2018')
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingRtkNetConfigUserContent').send_keys(
                    '0501')
                driver.find_element_by_id(
                    'com.southgnss.pnstar:id/editTextSettingRtkNetConfigPasswordContent').send_keys('0502')
                driver.find_element_by_id('com.southgnss.pnstar:id/checkboxPSW').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/checkboxPSW').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigMode').click()
                driver.find_element_by_name(G[e]).click()
                if e == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigAcceptPoint').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('123')
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/switchIsAutoConnect').click()
                if e == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonCancel').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonSure').click()
                e += 1
            driver.back()
        if t == 5:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfig').click()
            driver.back()
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigWifiConfig').click()
            driver.back()
            for B in range(2):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutRadioRouteMode').click()
                driver.find_element_by_name(A[B]).click()
        if t == 6:
            for C in range(2):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutRoverStationClosingAngle').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('13.0')
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').click()
                if C == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
            data = driver.page_source
            if '气泡校准'  not in data:
                driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchIsAcclivitousEqualize').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutLevelBubbleAdjust').click()
            driver.back()
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutMagneticAdjust').click()
            driver.back()
            driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchIsKeepOriginalData').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchIsXLINK').click()
            driver.back()
        t += 1
def 基准站():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.page_source
    if data == ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
        driver.find_element_by_name('蓝牙').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueSearch').click()
        time.sleep(8)
        driver.back()
        if 'SG1197133311873' in data:
            driver.find_element_by_name('SG1197133311873').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
            time.sleep(15)
    else:
        driver.back()
    time.sleep(3)
    driver.find_element_by_name('基准站').click()
    a = driver.page_source
    if '确定' in a:
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        time.sleep(5)
    b = driver.page_source
    if '启动' not in b:
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonStaticCollectDisConnect').click()
    c = ['RTD','RTCM23','RTCM30','RTCM32','CMR','SCMRX']
    d = 0
    while d < 6:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutBaseStationDifferenceFormate').click()
        driver.find_element_by_name(c[d]).click()
        d += 1
    for e in range(2):
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutBaseStationSendInterval').click()
        driver.find_element_by_name(str(e + 1)).click()
    for k in range(2):
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutBaseStationCoordinate').click()
        if k > 0:
            f = ['手动启动','重复设站','自动单点启动','智能单点启动','星基站']
            g = 0
            while g < 5:
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutBaseStationMode').click()
                driver.find_element_by_name(f[g]).click()
                g += 1
            driver.find_element_by_id('com.southgnss.pnstar:id/radioRourceBLH').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextCoordinatela').send_keys('23.1')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextCoordinatelo').send_keys('113.2')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextHigh').send_keys('20.0')
            driver.find_element_by_id('com.southgnss.pnstar:id/radioRourceNEH').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextNorth').send_keys('100')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextEarth').send_keys('150')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextHigh').send_keys('20')
            h = ['获取定位','点库获取','历史基站获取']
            for j in range(3):
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewTitleExt').click()
                driver.find_element_by_name(h[j]).click()
                if j == 1:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt1')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('23.1')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('113.2')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('20')
                    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
                    driver.find_element_by_name('Pt1').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
                elif j == 2:
                    time.sleep(2)
                    TouchAction(driver).press(x=130, y=300).release().perform()
                    time.sleep(2)
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonSure').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonCancel').click()
    l = ['直高', '斜高', '杆高', '测片']
    m = 0
    while m < 4:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutBaseStationAntennaHigh').click()
        driver.find_element_by_name(l[m]).click()
        driver.find_element_by_id('com.southgnss.pnstar:id/editTextAntennaHigh').send_keys('1.80')
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        m += 1
        time.sleep(1)
    n = 0
    while n < 4:
        if n < 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutBaseStationClosingAngle').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('1.0')
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutBaseStationPdop').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('1.0')
        if n % 2 == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        n += 1
    o = ['不使用','接收机移动网络','内置电台','外置电台','双发射','接收机WIFI网络','星链']
    time.sleep(2)
    p = 0
    while p < 7:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkDataLink').click()
        driver.find_element_by_name(o[p]).click()
        time.sleep(5)
        if p != 0 and p != 3 and p != 4 and p != 6:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfig').click()
            driver.find_element_by_id('android:id/action_bar_title').click()
            if p == 5:
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfigWifiConfig').click()
                driver.find_element_by_name('刷新WIFI列表...').click()
                time.sleep(30)
        p += 1
    for q in range(2):
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchIsKeepOriginalData').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBasicStationConnect').click()
def 静态设置():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.page_source
    if data == ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
        driver.find_element_by_name('蓝牙').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueSearch').click()
        time.sleep(8)
        driver.back()
        if 'SG1197133311873' in data:
            driver.find_element_by_name('SG1197133311873').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
            time.sleep(15)
    else:
        driver.back()
    time.sleep(3)
    driver.find_element_by_name('静态设置').click()
    a = driver.page_source
    if '确定' in a:
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        time.sleep(5)
    j = driver.page_source
    if '启动' not in j:
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonStaticCollectDisConnect').click()
    g = 0
    while g < 2:
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('10')
        if g == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
        g += 1
    if __name__ == '__main__':
        swipeUp(driver)
    b = ['0.02','0.05','0.1','0.2','1','2','5','10','15','30','60','300','600']
    c = 0
    while c < 13:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutStaticCollectInterval').click()
        driver.find_element_by_name(b[c]).click()
        c += 1
    d = ['直高','斜高','杆高','测片']
    e = 0
    while e < 4:
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutStaticCollectAntennaHigh').click()
        driver.find_element_by_name(d[e]).click()
        driver.find_element_by_id('com.southgnss.pnstar:id/editTextAntennaHigh').send_keys('1.80')
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        e += 1
        time.sleep(1)
    f = 0
    while f < 4:
        if f < 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutStaticCollectClosingAngle').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('1.0')
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutStaticCollectPdop').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('1.0')
        if f % 2 == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        f += 1
    for h in range(2):
        driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchAutoRecord').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonStaticCollectConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
def 设备信息():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备信息').click()
    if __name__ == '__main__':
        swipeUp(driver)
        swipeDown(driver)
    driver.back()
def 高级设置():
    for j in range(3):
        driver.find_element_by_name('配置').click()
        driver.find_element_by_name('设备连接').click()
        time.sleep(4)
        data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
        if data is not None:
            driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
            driver.find_element_by_name('蓝牙').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueSearch').click()
            time.sleep(8)
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueStopSearch').click
            for p in range(10):
                w = driver.page_source
                if 'SG1197133311873' in w:
                    driver.find_element_by_name('SG1197133311873').click()
                    break
                else:
                    driver.swipe(200, 896, 200, 436)
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
            time.sleep(15)
        else:
            driver.back()
        time.sleep(3)
        driver.find_element_by_name('高级设置').click()
        if j == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSatelliteControl').click()
            for a in range(2):
                driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchSateControlGps').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchSateControlBds').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchSateControlSbas').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchSateControlQzss').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchSateControlGlonass').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/UISwitchSateControlGalileo').click()
            driver.find_element_by_id('android:id/action_bar_title').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutAboutMachineStatus').click()
            driver.find_element_by_id('android:id/action_bar_title').click()
        if j < 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutAboutMachine').click()
        if j == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchIsUseSound').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingClearSatellite').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingClearSatellite').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
            driver.back()
            driver.back()
            time.sleep(20)
            continue
        if j == 1:
            c = ['中文','ENGLISH','RUSSIAN','SPANISH','KOREAN','PORTUGUESE']
            for b in range(6):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingAboutMachineSelectLangu').click()
                driver.find_element_by_name(c[b]).click()
            for d in range(2):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingAboutMachineSelfCheck').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAllSelect').click()
                if d == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingAboutMachineReg').click()
            driver.find_element_by_id('android:id/action_bar_title').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchIsUseAlarm').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/uISwitchIsUseAlarm').click()
            for e in range(2):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingAuthCode').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('10')
                if e == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
            for f in range(2):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingAboutMachineDiskFormate').click()
                if f == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
            for g in range(2):
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingAboutMachineRestoreFactory').click()
                if g == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                    driver.back()
                    driver.back()
                    time.sleep(20)
            continue
        for h in range(2):
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsStart').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/switchIsStartBluetoothConnect').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/LinearLayoutDeviceBinding').click()
        driver.find_element_by_id('android:id/action_bar_title').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/LinearLayoutQCodeShare').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutGetQCodeShareLinkSetting').click()
        driver.back()
        driver.find_element_by_id('android:id/action_bar_title').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/LinearLayoutRTKFirmwareDown').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/LinearLayoutRTKFirmwareUpdate').click()
        k = driver.page_source
        if '文件导入' in k:
            driver.back()
        if __name__ == '__main__':
            swipeUp(driver)
        driver.find_element_by_id('com.southgnss.pnstar:id/LinearLayoutOpenWebPage').click()
        l = driver.page_source
        if '当前Wifi连接的主机机身号' in l:
            driver.find_element_by_name('取消').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/LinearLayoutOpenWebPage').click()
            driver.find_element_by_name('确定').click()
            time.sleep(5)
            driver.back()
        driver.find_element_by_id('android:id/action_bar_title').click()
# def S86/S82主机设置():
def 点测量():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.page_source
    if data == ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
        driver.find_element_by_name('蓝牙').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueSearch').click()
        time.sleep(8)
        driver.back()
        if 'SG1197133311873' in data:
            driver.find_element_by_name('SG1197133311873').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
            time.sleep(15)
    else:
        driver.back()
    time.sleep(3)
    driver.find_element_by_name('移动站').click()
    z = driver.page_source
    if '是否切换移动站' in z:
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        time.sleep(2)
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkDataLink').click()
    driver.find_element_by_name('手机网络').click()
    y = driver.page_source
    if '数据链' not in y:
         time.sleep(10)
    driver.find_element_by_id('com.southgnss.pnstar:id/layoutSettingRtkNetConfig').click()
    driver.find_element_by_name('内网<172.16.10.74:2018>').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonEdit').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/ImageView02').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('CHDS_MSM4')
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonSure').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonDisConnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonConnect').click()
    time.sleep(1)
    driver.back()
    driver.back()
    driver.find_element_by_name('测量').click()
    driver.find_element_by_name('点测量').click()
    time.sleep(3)
    for r in range(2):
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonZoomAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonMainUIMapCentralYes').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btnType').click()
    driver.back()
    e = 0
    sum = 0
    d = 0
    while d < 4:
        if e < 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/bottomBtn' + str(e + 1)).click()
            a = driver.page_source
            if  '有上述问题' in a:
                if d == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                    sum += 1
            time.sleep(1)
            if e > 0:
                if sum > 0 or '有上述问题' not in a:
                    driver.find_element_by_id('com.southgnss.pnstar:id/edtOffsetDistance').send_keys('10')
                    driver.find_element_by_id('com.southgnss.pnstar:id/edtHeightDifference').send_keys('10')
                    driver.find_element_by_id('com.southgnss.pnstar:id/edtAzimuth').send_keys('45')
                    driver.find_element_by_id('com.southgnss.pnstar:id/radioBtn2').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonCollectConditionHRMSSelect').click()
                    driver.find_element_by_name('pt1').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
                    if d < 2:
                        driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
                    else:
                        driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
            time.sleep(1)
            t = driver.page_source
            if '天线量取高度' in t:
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('a' + str(e))
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewCode').send_keys('1')
                driver.find_element_by_id('com.southgnss.pnstar:id/ivArrow').click()
                TouchAction(driver).press(x=300, y=500).release().perform()
                b = ['直高','斜高','杆高','测片']
                c = 0
                while c < 4:
                    driver.find_element_by_name(b[c]).click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewConditionantennaHigh').send_keys('1.8')
                    c += 1
                if d > 2:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonSurfaceSaveSure').click()
                    d = 0
                    sum = 0
                    e += 1
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonSurfaceSaveCancel').click()
        if e == 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/bottomBtn' + str(e + 1)).click()
            f = ['5' ,'10','15','30']
            for g in range(4):
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewCollectConditionSmoothNums').click()
                driver.find_element_by_name(f[g]).click()
            for h in range(4):
                if h > 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/bottomBtn' + str(e + 1)).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewCollectConditionSmoothNums').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/pen').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('3')
                if h < 1:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
                    time.sleep(5)
                    j = driver.page_source
                    if '有上述问题' not in j:
                        driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('a' + str(e))
                        driver.find_element_by_id('com.southgnss.pnstar:id/textViewCode').send_keys('1')
                        driver.find_element_by_id('com.southgnss.pnstar:id/ivArrow').click()
                        driver.find_element_by_name('林地').click()
                        o = ['直高', '斜高', '杆高', '测片']
                        p = 0
                        while p < 4:
                            driver.find_element_by_name(o[p]).click()
                            driver.find_element_by_id(
                                'com.southgnss.pnstar:id/textViewConditionantennaHigh').send_keys('1.8')
                            p += 1
                        if h > 1:
                            driver.find_element_by_id('com.southgnss.pnstar:id/buttonSurfaceSaveSure').click()
                            e += 1
                        else:
                            driver.find_element_by_id('com.southgnss.pnstar:id/buttonSurfaceSaveCancel').click()
                    else:
                        if h == 1:
                            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                        else:
                            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                            for w in range(2):
                                driver.back()
                                k = driver.page_source
                                if '正在采集中,是否停止采集?' in k:
                                    if w == 0:
                                        driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                                    else:
                                        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                                        e += 1
        if e == 3:
            driver.find_element_by_id('com.southgnss.pnstar:id/bottomBtn' + str(e + 1)).click()
            time.sleep(1)
            l = driver.page_source
            q = 0
            while q < 3:
                if 'a' + str(q) not in l:
                    print('不存在a' + str(q - 1) +'点')
                q += 1
            driver.find_element_by_id('android:id/action_bar_title').click()
            e += 1
        if e == 4:
            driver.find_element_by_id('com.southgnss.pnstar:id/bottomBtn' + str(e + 1)).click()
            for m in range(5):
                driver.find_element_by_id('com.southgnss.pnstar:id/radioBtn' + str(m + 1)).click()
            driver.find_element_by_id('com.southgnss.pnstar:id/edtSmoothTimes').send_keys('6')
            n = 0
            while n < 2:
                driver.find_element_by_id('com.southgnss.pnstar:id/switchIsUsePPK').click()
                if n == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/bottomBtn' + str(e + 1)).click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
                n += 1
            d = 4
        d += 1
def 自动测量():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    time.sleep(2)
    driver.find_element_by_name('测量').click()
    driver.find_element_by_name('自动测量').click()
    time.sleep(3)
    a = 0
    while a < 5:
        driver.find_element_by_id('com.southgnss.pnstar:id/bottomBtn' + str(a + 1)).click()
        if a == 0:
            time.sleep(5)
        if a == 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextPointName').send_keys('b' + str(a))
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextPointCode').send_keys('1')
            time.sleep(1)
            b = ['直高','斜高','杆高','测片']
            c = 0
            while c < 4:
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewCollectConditionAntennaHigh').click()
                driver.find_element_by_name(b[c]).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextInput').send_keys('1.8')
                if c == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                c += 1
            driver.find_element_by_id('com.southgnss.pnstar:id/radioDistance').click()
            d = 0
            e = ['0.2','0.5','1.0','2.0','5.0','10.0','15.0','30.0','50.0','100.0']
            while d < 12:
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewCollectConditionDistanceInterval').click()
                if d < 10:
                    driver.find_element_by_name(e[d]).click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/pen').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('2.5')
                    if d == 10:
                        driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                    else:
                        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                d += 1
            f = ['单点解','差分解','浮点解','固定解']
            g = 0
            while g < 4:
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewCollectConditionStatusLimit').click()
                driver.find_element_by_name(f[g]).click()
                g += 1
            driver.find_element_by_id('com.southgnss.pnstar:id/radioTime').click()
            h = ['1','2','3','5','10','20','30','60','120']
            j = 0
            while j < 11:
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewCollectConditionTimeInterval').click()
                if j < 9:
                    driver.find_element_by_name(h[j]).click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/pen').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextSelectTemplate').send_keys('2.5')
                    if j == 9:
                        driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                    else:
                        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                j += 1
            driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/bottomBtn' + str(a + 1)).click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
        if a == 3:
            driver.back()
        if a == 4:
            k = ['提示','不提示']
            l = 0
            while l < 2:
                driver.find_element_by_id('com.southgnss.pnstar:id/tvSavePointTips').click()
                driver.find_element_by_name(k[l]).click()
                if l == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/bottomBtn' + str(a + 1)).click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
                l += 1
            driver.back()
        a += 1
def 控制点测量():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('测量').click()
    driver.find_element_by_name('控制点测量').click()
    time.sleep(3)
    a = 0
    while a < 5:
        driver.find_element_by_id('com.southgnss.pnstar:id/bottomBtn' + str(a + 1)).click()
        if a == 0:
            for e in range(3):
                driver.find_element_by_name('开始').click()
                time.sleep(2)
                if e == 0:
                    driver.find_element_by_name('停止').click()
                    driver.find_element_by_name('取消').click()
                    time.sleep(10)
                    g = ['直高','斜高','杆高','测片']
                    h = 0
                    while h < 4:
                        driver.find_element_by_name(g[h]).click()
                        h += 1
                else:
                    time.sleep(40)
                    f = driver.page_source
                    if '保存测量点' in f:
                        driver.find_element_by_id('com.southgnss.pnstar:id/item_image').click()
                        driver.back()
                        time.sleep(1)
                        if e == 1:
                            driver.find_element_by_id('com.southgnss.pnstar:id/buttonSurfaceSaveCancel').click()
                        if e > 0:
                            driver.find_element_by_id('com.southgnss.pnstar:id/buttonControlPointReport').click()
                            driver.find_element_by_id('com.southgnss.pnstar:id/editTextExportFileName').send_keys('3')
                            driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
                        h = driver.page_source
                        if '是否查看GPS控制点测量报告？' in h:
                            if e == 2:
                                driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                                time.sleep(1)
                                driver.back()
                            else:
                                driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                        if e == 2:
                            driver.find_element_by_id('com.southgnss.pnstar:id/buttonSurfaceSaveSure').click()
                            driver.back()

        if a == 1:
            driver.back()
        if a == 2:
            d = 0
            while d < 2:
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingTestNums').send_keys('3')
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingTestPointNums').send_keys('4')
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingEncoysNums').send_keys('4')
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingPlaneLimit').send_keys('0.03')
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextSettingAltitudeLimit').send_keys('0.03')
                if d == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/bottomBtn' + str(a + 1)).click()
                else:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
                d += 1
        if a == 3:
            driver.find_element_by_id('android:id/action_bar_title').click()
        a += 1
def 求转换参数():
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('求转换参数').click()
    i = 0
    B = [250,300,350]
    while i < 2:
        driver.find_element_by_id('com.southgnss.pnstar:id/btImport').click()
        time.sleep(1)
        TouchAction(driver).press(x=200, y=200).release().perform()
        time.sleep(1)
        TouchAction(driver).press(x=B[i], y=B[i+1]).release().perform()
        time.sleep(2)
        if __name__ == '__main__':
            swipeUp(driver)
            time.sleep(1)
            swipeUp(driver)
            time.sleep(1)
            swipeUp(driver)
            time.sleep(1)
        driver.find_element_by_name('工程之星必备数据').click()
        driver.find_element_by_name('一步法+各种判断的方法.cot').click()
        time.sleep(1)
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        if i == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        i += 1

    """输入六组数据做计算"""
    M = [['2555835.812','435611.940','-2.609','23.0601289173','113.2217456429','-2.609']
         ,['2561768.909','436534.853','9.651','23.0914269181','113.2248999623','9.651']
         ,['2556110.325','440584.616','-2.761','23.0610880999','113.2512146599','-2.700']
         ,['2556976.734','438434.841','-1.810','23.0638760666','113.2356481451','-1.800']
         ,['2560227.772','438732.603','1.506','23.0824473918','113.2406476436','1.506']
         ,['2555831.347','435625.333','-2.390','23.0601145914','113.2217927701','-2.390']
         ,['2555840.347','435633.333','-2.5','23.0701145914','113.2317927701','-2.5']]
    p = 0
    x = 0
    a = 0
    while p < 6:
        a += 1
        driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/EditTextPointName').send_keys('pt'+str(a))
        driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateLeavelN').send_keys(M[p][0])
        driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateLeavelE').send_keys(M[p][1])
        driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateLeavelH').send_keys(M[p][2])
        driver.find_element_by_id('com.southgnss.pnstar:id/editTextCoordinateGroundB').send_keys(M[p][3])
        driver.find_element_by_id('com.southgnss.pnstar:id/editTextCoordinateGroundL').send_keys(M[p][4])
        driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateGroundH').send_keys(M[p][5])
        time.sleep(1)
        if __name__ == '__main__':
            swipeUp(driver)
        time.sleep(1)
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxUseElevation').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxUseElevation').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxUsePlane').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxUsePlane').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
        p += 1

    """使用一步法的对比参数"""
    R = [['2563197.035','431733.625','20.064']
        ,['2563197.036','431733.622','20.000']
        ,['2563197.035','431733.625','20.064']
         ,['2563197.035','431733.625','19.988']]

    """使用二步法和未使用残差的对比参数"""
    S = [['2562969.347','431407.526','-30.365']
        ,['2562969.347','431407.526','-30.365']
         ,['2562969.347','431407.526','20.281']
         ,['2562969.347','431407.526','20.708']]

    """使用二步法和使用残差的对比参数"""
    D = [['2562969.347','431407.526','-30.365']
         ,['2562969.347','431407.526','-30.365']
         ,['2562969.347','431407.526','20.279']
         ,['2562969.347','431407.526','20.708']]
    Q = [['2563197.033','431733.622','20.064'],]
    U = ['一步法','二步法','七参数','']
    L = ['自动判断','曲面拟合','平面拟合','加权平均','']
    F = [R,S,D,Q]
    e = 0
    w = 0
    g = 0
    sum = 0
    LX = [ '','未使用残差','使用残差','']
    while e < 6:
        if e == 4 and sum == 0:
           driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
           driver.find_element_by_id('com.southgnss.pnstar:id/EditTextPointName').send_keys('pt7')
           driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateLeavelN').send_keys(M[6][0])
           driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateLeavelE').send_keys(M[6][1])
           driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateLeavelH').send_keys(M[6][2])
           driver.find_element_by_id('com.southgnss.pnstar:id/editTextCoordinateGroundB').send_keys(M[6][3])
           driver.find_element_by_id('com.southgnss.pnstar:id/editTextCoordinateGroundL').send_keys(M[6][4])
           driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateGroundH').send_keys(M[6][5])
           driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
        if e == 4:
            e = 0
            x = 0
            sum += 1
        if sum == 1 or sum == 2:
            g = 1
        elif sum == 3:
             g = 2
        T = F[sum]
        if g == 2:
           driver.find_element_by_name('pt7').click()
           driver.find_element_by_name('删除').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/itemSetting').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordTransform').click()
        if not g == 3:
            driver.find_element_by_name(U[g]).click()
        if not g == 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewHeightFitting').click()
            driver.find_element_by_name(L[e]).click()
        if e == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateLeavel').send_keys('0.1')
            driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateHeight').send_keys('0.1')
        if g == 1 and sum == 2 and e == 0:
           driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxUseDifference').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/btCaculate').click()
        time.sleep(1)
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        time.sleep(1)
        QL = driver.page_source
        if 'NO.1' in QL:
            driver.find_element_by_name('确定').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/btApply').click()
        A = driver.page_source
        if 'NO.1' in A:
            driver.find_element_by_name('确定').click()
        if g == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btApply').click()
            D = driver.page_source
            if 'NO.1' in D:
                driver.find_element_by_name('确定').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        driver.find_element_by_name('坐标转换').click()
        if __name__ == '__main__':
            swipeUp(driver)
            time.sleep(1)
        driver.find_element_by_id('com.southgnss.pnstar:id/editTextCoordinateInputX').send_keys('23.1')
        driver.find_element_by_id('com.southgnss.pnstar:id/editTextCoordinateInputY').send_keys('113.2')
        driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateInputH').send_keys('20')
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonForwardSolution').click()
        data_x = driver.find_element_by_id('com.southgnss.pnstar:id/EditTextOutputX').text
        data_y = driver.find_element_by_id('com.southgnss.pnstar:id/EditTextOutputY').text
        data_h = driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateOutputH').text
        if g == 2:
            x = 4
        if  abs(float(data_x) - float(T[e][w])) <= 0.01:
            print(U[g]+L[x]+LX[sum]+'x正确')
        else:
            print(U[g]+L[x]+LX[sum]+'x错误')
        if  abs(float(data_y) - float(T[e][w+1])) <= 0.01:
            print(U[g]+L[x]+LX[sum]+'y正确')
        else:
            print(U[g]+L[x]+LX[sum]+'y错误')
        if  abs(float(data_h) - float(T[e][w+2])) <= 0.01:
            print(U[g]+L[x]+LX[sum]+'h正确')
        else:
            print(U[g]+L[x]+LX[sum]+'h错误')
        e += 1
        x += 1
        if g == 2 and e == 1:
           driver.back()
           break
        driver.find_element_by_id('android:id/action_bar_title').click()
        driver.find_element_by_name('求转换参数').click()
def 校正向导():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    i = 0
    while i < 3:
        if i < 2:
            driver.find_element_by_name('校正向导').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
        if i == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutObject').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt1')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('23.1')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('113.2')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('20')
            driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
            driver.find_element_by_name('Pt1').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/edtAntennaHeight').send_keys('1.8')
            driver.find_element_by_id('com.southgnss.pnstar:id/radioStraigh').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/radioPole').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/radioSide').click()
        if i == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/edtPointName').send_keys('1')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextDestCoorX').send_keys('23.1')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextDestCoorY').send_keys('113.2')
            driver.find_element_by_id('com.southgnss.pnstar:id/edtAntennaHeight').send_keys('20')
            driver.find_element_by_id('com.southgnss.pnstar:id/edtAntennaHeight').send_keys('1.8')
            driver.find_element_by_id('com.southgnss.pnstar:id/checkBox').click()
            TouchAction(driver).press(x=500, y=850).release().perform()
            driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt2')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('23.1')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('113.2')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('20')
            driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
            driver.find_element_by_name('Pt2').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/editTextDestCoorH').send_keys('20')
        if i == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/btnCorrect').click()
        i += 1
def 坐标转换():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('坐标转换').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/radioRourceXYH').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/radioRourceXYZ').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/radioRourceBLH').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/radioObjectXYH').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/radioObjectXYZ').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/radioObjectBLH').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/radioObjectXYH').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonCollectConditionDistanceIntervalSelect').click()
    driver.find_element_by_name('WGS84.sys').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonCollectConditionDistanceIntervalSelect').click()
    driver.find_element_by_name('当前坐标系统参数').click()
    if __name__ == '__main__':
        swipeUp(driver)
    i = 0
    while i < 7:
        if i == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextCoordinateInputX').send_keys('23.1')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextCoordinateInputY').send_keys('113.2')
            driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateInputH').send_keys('20')
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonForwardSolution').click()
        if i == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/EditTextOutputX').send_keys('23.1')
            driver.find_element_by_id('com.southgnss.pnstar:id/EditTextOutputY').send_keys('113.2')
            driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateOutputH').send_keys('20')
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBackCalculation').click()
        if i == 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSourse').click()
            driver.find_element_by_name('定位获取').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonForwardSolution').click()
        if i == 3:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutObject').click()
            driver.find_element_by_name('定位获取').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBackCalculation').click()
        if i == 4:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutSourse').click()
            driver.find_element_by_name('点库获取').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt1')
            driver.find_element_by_id('com.southgnss.pnstar:id/radioRourceBLH').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_1').send_keys('23.1')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_2').send_keys('113.2')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('20')
            driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
            driver.find_element_by_name('Pt1').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonForwardSolution').click()
        if i == 5:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutObject').click()
            driver.find_element_by_name('点库获取').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt2')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('23.1')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('113.2')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('20')
            driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
            driver.find_element_by_name('Pt2').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonBackCalculation').click()
        A = driver.find_element_by_id('com.southgnss.pnstar:id/EditTextOutputX').text
        B = driver.find_element_by_id('com.southgnss.pnstar:id/EditTextOutputY').text
        C = driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateOutputH').text
        D = driver.find_element_by_id('com.southgnss.pnstar:id/editTextCoordinateInputX').text
        E = driver.find_element_by_id('com.southgnss.pnstar:id/editTextCoordinateInputY').text
        F = driver.find_element_by_id('com.southgnss.pnstar:id/EditTextCoordinateInputH').text
        if i != 2 and i != 3:
            if i % 2 == 0:
                if abs(float(A)-float(2563151.355)) <= 1.000:
                    print('正向转换x正确')
                else:
                    print('正向转换x错误')
                if abs(float(A)-float(431734.774)) <= 1.000:
                    print('正向转换y正确')
                else:
                    print('正向转换y错误')
                if C == '20.000':
                    print('正向转换h正确')
                else:
                    print('正向转换h错误')
            else:
                if abs(float(D)-float(000.0000749754) )<= 1.000:
                    print('反向向转换x正确')
                else:
                    print('反向转换x错误')
                if abs(float(E)-float(109.3050622023)) <= 1.000:
                    print('反向转换y正确')
                else:
                    print('反向转换y错误')
                if F == '20.000':
                    print('反向转换h正确')
                else:
                    print('反向转换h错误')
        else:
            if i % 2 == 0:
                if abs(float(A)-float(2544537.948)) <= 1.000:
                    print('正向转换x正确')
                else:
                    print('正向转换x错误')
                if abs(float(A)-float(499999.829)) <= 1.000:
                    print('正向转换y正确')
                else:
                    print('正向转换y错误')
                if abs(float(C) - float(38.200)) <= 1.000:
                    print('正向转换h正确')
                else:
                    print('正向转换h错误')
            else:
                if abs(float(D)-float(023.0000012000) )<= 1.000:
                    print('反向向转换x正确')
                else:
                    print('反向转换x错误')
                if abs(float(E)-float(113.5959994000)) <= 1.000:
                    print('反向转换y正确')
                else:
                    print('反向转换y错误')
                if abs(float(F) - float(38.200)) <= 1.000:
                    print('反向转换h正确')
                else:
                    print('反向转换h错误')
        i += 1
    driver.back()
def 面积计算():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    time.sleep(5)
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('面积计算').click()
    i = 0
    p = ['手动输入', '定位获取', '点库获取']
    while i < 8:
        data = driver.page_source
        if '多选' in data and i < 5:
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
            if i < 4:
                driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
            elif i == 4:
                driver.find_element_by_id('com.southgnss.pnstar:id/barSelectMiddle').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/barCalculate').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        elif i == 5:
            r = 0
            while r < 2:
                driver.find_element_by_id('com.southgnss.pnstar:id/btSave').click()
                page = driver.page_source
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextExportFileName').send_keys('12.3')
                if r == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
                else:
                    if '12.3' in page:
                        driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
                        driver.find_element_by_name('确定').click()
                    else:
                        driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
                r += 1
        if i == 0:
            l = 0
            while l < 3:
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_name(p[i]).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/edtName').send_keys('Pt' + str(l + 1))
                driver.find_element_by_id('com.southgnss.pnstar:id/edtCode').send_keys('ds')
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_1').send_keys(
                    12 * (l + 1))
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_2').send_keys(
                    12 * (l + 1))
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys(
                    12 * (l + 1))
                driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                l += 1
        if i == 1:
            u = 0
            while u < 3:
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_name(p[i]).click()
                u += 1
        if i == 2:
            m = 1
            while m < 4:
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_name(p[i]).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt'+str(m))
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys(12*m)
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys(12*m)
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys(12*m)
                driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
                driver.find_element_by_name('Pt' + str(m)).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
                m += 1
        if i == 3:
            driver.find_element_by_id('com.southgnss.pnstar:id/btOpen').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/tv_return_root').click()
            if __name__ == '__main__':
                swipeUp(driver)
                swipeUp(driver)
            driver.find_element_by_name('工程之星必备数据').click()
            driver.find_element_by_name('工程之星坐标管理库导入').click()
            driver.find_element_by_name('Pn，x，y，h，Pc.dat').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
        if i == 6:
            driver.find_element_by_id('com.southgnss.pnstar:id/itemMapSelect').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonMainUIMapCentralYes').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnCalculateAreaMode').click()
            if __name__ == '__main__':
                for a in range(2):
                    screen_pinch()
                for a in range(2):
                    screen_zoom()
            driver.find_element_by_id('com.southgnss.pnstar:id/btClear').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btCalculate').click()
            driver.find_element_by_id('android:id/action_bar_title').click()
        if i == 7:
            u = 0
            k = 0
            c = 0
            x = 0
            w = ['编辑', '删除']
            while u < 3:
                if k > 1:
                    k = 1
                if x != 0:
                    driver.find_element_by_name('Pt1').click()
                    driver.find_element_by_name(w[k]).click()
                if x == 0:
                    while c < 2:
                        driver.find_element_by_name('校正点1').click()
                        driver.find_element_by_name(w[k]).click()
                        driver.find_element_by_id('com.southgnss.pnstar:id/edtName').send_keys('Pt' + str(u + 1))
                        driver.find_element_by_id('com.southgnss.pnstar:id/edtCode').send_keys('ds')
                        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_1').send_keys( 12 * (u + 1))
                        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_2').send_keys( 12 * (u + 1))
                        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys( 12 * (u + 1))
                        if c == 1:
                            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                        else:
                            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                        c += 1
                if x != 0:
                    if x == 1:
                        driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
                    else:
                        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                u += 1
                x += 1
                k += 1
        if i < 4:
            driver.find_element_by_id('com.southgnss.pnstar:id/btCalculate').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
        i += 1
    driver.back()
    driver.back()
def 间接测量():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('间接测量').click()
    i = ['一点线角法(线向推导)','两点两线法','两点两角法','三点圆心法','两点线角法','两线相交法','获取全站仪的数据','RTK摇一摇']
    m = 0
    t = 0
    q = 0
    w = 0
    while m < 17:
        x = int(m/2)
        if __name__ == '__main__':
            swipeDown(driver)
        if m < 15:
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewIndirectSurveyMethodShow').click()
            driver.find_element_by_name(i[x]).click()
        if m < 12:
            driver.find_element_by_name('更多获取方式').click()
            if t % 2 == 0:
                driver.find_element_by_name('定位获取').click()
            else:
                driver.find_element_by_name('点库获取').click()
                if t == 1:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt1')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('1')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('1')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('1')
                    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
                driver.find_element_by_name('Pt1').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
        if __name__ == '__main__':
            swipeUp(driver)
        if t < 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextPointAngleAlpha').send_keys('1.0')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextPointLine').send_keys('1.0')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextPointLineH').send_keys('1.0')
        data = driver.page_source
        if '两点两线法' in data:
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewPointB').click()
            driver.find_element_by_name('更多获取方式').click()
            if t % 2 == 0:
                driver.find_element_by_name('定位获取').click()
            else:
                driver.find_element_by_name('点库获取').click()
                if t == 3:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt2')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('2')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('2')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('2')
                    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
                driver.find_element_by_name('Pt2').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextLine1').send_keys('1')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextLine2').send_keys('1')
        if '两点两角法' in data:
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewPointB').click()
            driver.find_element_by_name('更多获取方式').click()
            if t % 2 == 0:
                driver.find_element_by_name('定位获取').click()
            else:
                driver.find_element_by_name('点库获取').click()
                driver.find_element_by_name('Pt2').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextAngle1').send_keys('1')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextAngle2').send_keys('1')
        if '三点圆心法' in data:
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewPointB').click()
            driver.find_element_by_name('更多获取方式').click()
            if t % 2 == 0:
                driver.find_element_by_name('定位获取').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordrB3').send_keys('20')
            else:
                driver.find_element_by_name('点库获取').click()
                if t == 7:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt3')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('5')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('8')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('9')
                    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
                driver.find_element_by_name('Pt3').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordrB2').send_keys('20')
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewPointC').click()
            driver.find_element_by_name('更多获取方式').click()
            if t % 2 == 0:
                driver.find_element_by_name('定位获取').click()
            else:
                driver.find_element_by_name('点库获取').click()
                driver.find_element_by_name('Pt3').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
        if '两点线角法' in data:
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewPointB').click()
            driver.find_element_by_name('更多获取方式').click()
            if t % 2 == 0:
                driver.find_element_by_name('定位获取').click()
            else:
                driver.find_element_by_name('点库获取').click()
                driver.find_element_by_name('Pt2').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextAngle1').send_keys('1')
            driver.find_element_by_id('com.southgnss.pnstar:id/editTextLine2').send_keys('1')
        if '两线相交法' in data:
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewPointB').click()
            driver.find_element_by_name('更多获取方式').click()
            if t % 2 == 0:
                driver.find_element_by_name('定位获取').click()
            else:
                driver.find_element_by_name('点库获取').click()
                driver.find_element_by_name('Pt2').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewPointC').click()
            driver.find_element_by_name('更多获取方式').click()
            if t % 2 == 0:
                driver.find_element_by_name('定位获取').click()
            else:
                driver.find_element_by_name('点库获取').click()
                driver.find_element_by_name('Pt3').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewPointD').click()
            driver.find_element_by_name('更多获取方式').click()
            if t % 2 == 0:
                driver.find_element_by_name('定位获取').click()
            else:
                driver.find_element_by_name('点库获取').click()
                if t == 11:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt4')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('4')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('4')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('5')
                    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
                driver.find_element_by_name('Pt4').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
        if '获取全站仪的数据' in data:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonIndirectSurveySend').click()
        if 'RTK摇一摇' in data:
            s = 0
            p = ['直高','斜高','杆高','测片']
            while s < 4:
                driver.find_element_by_name(p[s]).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/editTextInput').send_keys('1.8')
                driver.find_element_by_id('com.southgnss.pnstar:id/buttonIndirectSurveySend').click()
                s += 1
            if s == 4:
                driver.back()
                break
        if m < 12:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonIndirectSurveyCaculate').click()
            A = driver.find_element_by_id('com.southgnss.pnstar:id/textViewIndirectSurveyResult').text
            B = re.findall(r"\d+\.?\d*", A)
            print(A)
            C = [['2.000','1.017','2.000'],['1.000','2.000','1.500'],['1.509','1.491','1.500'],['-13.625','14.000','6.333'],
                 ['2.695','2.719','2.000'],['4.000','4.000','4.500']]
            D = [['2544538.394','499999.846','39.300'],['2544538.760','500001.161','38.000'],['2544537.580','499999.740','37.800'],
                 ['2544537.035','499999.658','32.033'],['2544536.025','499999.721','38.000'],['2544469.129','500062.757','74.950']]
            if m % 2 == 1:
                if B[0] == C[q][0]:
                    print('N正确')
                else:
                    print('N错误')
                if B[1] == C[q][1]:
                    print('E正确')
                else:
                    print('E错误')
                if B[2] == C[q][2]:
                    print('H正确')
                else:
                    print('H错误')
                q += 1
            else:
                if abs(float(B[0]) - float(D[w][0])) <= 1.000:
                    print('N正确')
                else:
                    print('N错误')
                if abs(float(B[1]) - float(D[w][1])) <= 1.000:
                    print('E正确')
                else:
                    print('E错误')
                if abs(float(B[2]) - float(D[w][2])) <= 1.000:
                    print('H正确')
                else:
                    print('H错误')
                w += 1

        m += 1
        t += 1
def 角度换算():
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('角度换算').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSeclectUnitShow').click()
    time.sleep(1)
    TouchAction(driver).press(x=250, y=600).release().perform()
    driver.find_element_by_id('com.southgnss.pnstar:id/editTextUnitValue').send_keys('5')
    driver.find_element_by_name('开始换算').click()
    D = driver.find_element_by_id('com.southgnss.pnstar:id/editTextDegree').text
    if D == '286.47889757':
        print('弧度转换度正确')
    else:
        print('弧度转换度错误')
    DFM = driver.find_element_by_id('com.southgnss.pnstar:id/editTextDegreeOfNimute').text
    if DFM == '286.28440312':
        print('弧度转换度分秒正确')
    else:
        print('弧度转换度分秒错误')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSeclectUnitShow').click()
    time.sleep(1)
    TouchAction(driver).press(x=250, y=650).release().perform()
    driver.find_element_by_id('com.southgnss.pnstar:id/editTextUnitValue').send_keys('5')
    driver.find_element_by_name('开始换算').click()
    H = driver.find_element_by_id('com.southgnss.pnstar:id/editTextRadian').text
    if H == '0.0872664626':
        print('度转换弧度正确')
    else:
        print('度转换弧度错误')
    DFM = driver.find_element_by_id('com.southgnss.pnstar:id/editTextDegreeOfNimute').text
    if DFM == '5.00000000':
        print('度转换度分秒正确')
    else:
        print('度转换度分秒错误')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewSeclectUnitShow').click()
    time.sleep(1)
    TouchAction(driver).press(x=250, y=750).release().perform()
    driver.find_element_by_id('com.southgnss.pnstar:id/editTextUnitValue').send_keys('5')
    driver.find_element_by_name('开始换算').click()
    HD = driver.find_element_by_id('com.southgnss.pnstar:id/editTextRadian').text
    if HD == '0.0872664626':
        print('度分秒转换弧度正确')
    else:
        print('度分秒转换弧度错误')
    D = driver.find_element_by_id('com.southgnss.pnstar:id/editTextDegree').text
    if D == '5.00000000':
        print('度分秒转换度正确')
    else:
        print('度分秒转换度错误')
    driver.find_element_by_id('android:id/action_bar_title').click()
def 计算坐标():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('其它工具').click()
    driver.find_element_by_name('计算坐标').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_1').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_2').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_3').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_7').send_keys('45')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_8').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_9').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonCaculate').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
    time.sleep(3)
    driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
    A = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
    B = re.findall(r"\d+\.?\d*", A)
    d = ['起点北坐标','起点东坐标','起点高程','方位角','距离','高差','成果北坐标','成果东坐标','成果高差']
    w = ['1.000','1.000','1.000','45.00000000','1.000','1.000','1.707','1.707','2.000']
    q = 0
    while q < 9:
        if B[q] == w[q]:
            print(d[q]+'显示正确')
        else:
            print(d[q]+'显示错误')
        q += 1
    driver.find_element_by_name('保存').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('1.1好')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCode').send_keys('1.1好')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('1.1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('1.1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('1.1')
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
    driver.find_element_by_name('保存').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.find_element_by_name('数据输入').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/StartExternalobtain').click()
    driver.find_element_by_name('点库获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/StartExternalobtain').click()
    driver.find_element_by_name('点库获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
    driver.find_element_by_name('Pt1').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonCaculate').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
    time.sleep(3)
    driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
    C = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
    D = re.findall(r"\d+\.?\d*", C)
    Y = ['1.000','1.000','1.000','45.00000000','1.000','1.000','1.707','1.707','2.000']
    l = 0
    while l < 9:
        if D[l] == Y[l]:
            print(d[l]+'显示正确')
        else:
            print(d[l]+'显示错误')
        l += 1
    driver.find_element_by_name('保存').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.find_element_by_name('数据输入').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/StartExternalobtain').click()
    driver.find_element_by_name('定位获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonCaculate').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
    time.sleep(3)
    driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
    E = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
    F = re.findall(r"\d+\.?\d*", C)
    Q = ['2544537.763','499999.658','38.100','45.00000000','1.000','1.000','2544538.470','500000.365','39.100']
    r = 0
    while r < 9:
        if abs(float(F[r]) - float(Q[r])) <= 1.000:
            print(d[r]+'显示正确')
        else:
            print(d[r]+'显示错误')
        r += 1
    driver.find_element_by_name('保存').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
def 计算方位角():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('其它工具').click()
    driver.find_element_by_name('计算方位角').click()
    time.sleep(2)
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_1').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_2').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_3').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_4').send_keys('2')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_5').send_keys('2')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_6').send_keys('2')
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonCaculate').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
    time.sleep(3)
    driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
    A = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
    B = re.findall(r"\d+\.?\d*", A)
    Z = ['1.414','1.728','1.000','+45.00000000','1.500','1.500','1.500']
    Y = ['平距','空间距离','高差','方位角','中点北坐标','中点东坐标','中点高程']
    r = 0
    while r < 7:
        if B[r] == Z[r]:
            print(Y[r] + '显示正确')
        else:
            print(Y[r] + '显示错误')
        r += 1
    Q = 0
    while Q < 2:
        driver.find_element_by_name('保存').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('1.1好')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewCode').send_keys('1.1好')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('1.1')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('1.1')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('1.1')
        Q += 1
        if Q == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.find_element_by_name('数据输入').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/StartExternalobtain').click()
    driver.find_element_by_name('定位获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/EndExternalobtain').click()
    driver.find_element_by_name('定位获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonCaculate').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
    time.sleep(3)
    driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
    C = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
    D = re.findall(r"\d+\.?\d*", C)
    G = ['0.580','0.580','0.000','162.846','2544537.302','499999.744','38.200']
    w = 0
    while w < 7:
        if abs(float(D[w]) - float(G[w])) <= 1.000:
            print(Y[w] + '显示正确')
        else:
            print(Y[w] + '显示错误')
        w += 1
    H = 0
    while H < 2:
        driver.find_element_by_name('保存').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('1.1好')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewCode').send_keys('1.1好')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('1.1')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('1.1')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('1.1')
        H += 1
        if H == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.find_element_by_name('数据输入').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/StartExternalobtain').click()
    driver.find_element_by_name('点库获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/StartExternalobtain').click()
    driver.find_element_by_name('点库获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
    driver.find_element_by_name('Pt1').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/EndExternalobtain').click()
    driver.find_element_by_name('点库获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt2')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('2')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('2')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('2')
    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
    driver.find_element_by_name('Pt2').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonCaculate').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
    time.sleep(3)
    driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
    E = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
    F = re.findall(r"\d+\.?\d*", E)
    l = ['1.414','1.728','1.000','+45.00000000','1.500','1.500','1.500']
    x = 0
    while x < 7:
        if F[x] == l[x]:
            print(Y[x] + '显示正确')
        else:
            print(Y[x] + '显示错误')
        x += 1
    X = 0
    while X < 2:
        driver.find_element_by_name('保存').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('1.1好')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewCode').send_keys('1.1好')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('1.1')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('1.1')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('1.1')
        X += 1
        if X == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
def 偏角偏距():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('其它工具').click()
    driver.find_element_by_name('偏角偏距').click()
    i = 0
    p = ['定位获取','点库获取']
    y = ['StartExternalobtain','EndExternalobtain','StartExternalobtain2']
    while i < 3:
        driver.find_element_by_name('数据输入').click()
        if i == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_1').send_keys('3')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_2').send_keys('3')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_3').send_keys('2')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_4').send_keys('2')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_5').send_keys('1')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_6').send_keys('1')
        if i == 1:
            t = 0
            while t < 3:
                driver.find_element_by_id('com.southgnss.pnstar:id/'+str(y[t])).click()
                driver.find_element_by_name(p[0]).click()
                t += 1
        if i == 2:
            q = 0
            while q < 3:
                driver.find_element_by_id('com.southgnss.pnstar:id/' + str(y[q])).click()
                driver.find_element_by_name(p[1]).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt'+str(q+1))
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys(3-q)
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys(3-q)
                driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
                driver.find_element_by_name('Pt' + str(q + 1)).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
                q += 1
        driver.find_element_by_id('com.southgnss.pnstar:id/btnCalculate').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
        time.sleep(3)
        driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
        A = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
        B = re.findall(r"\d+\.?\d*", A)
        C = [['3.000','3.000','2.000','2.000','1.000','1.000','2.828','1.414','0.000','0.0'],
             ['2544537.579','499999.829','2544537.209','500000.342','2544537.209','500000.171','0.494','0.139','0.100','+144.11566327']
             ]
        D = [0.000,1.000]
        F = ['起点北坐标','起点东坐标','终点北坐标','终点东坐标','终点东坐标','偏点北坐标','偏点东坐标','起点距离垂距','终点距离垂距','偏移距',
             '偏转角']
        E = 0
        while E < 10:
            if abs(float(B[E]) - float(C[i%2][E]))<= D[i%2]:
                print(F[E]+'显示正确')
            else:
                print(F[E]+'显示错误')
            E += 1
        i += 1
def 偏点计算():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('其它工具').click()
    driver.find_element_by_name('偏点计算').click()
    i = 0
    z = 0
    sum = 0
    while z < 6:
        driver.find_element_by_name('数据输入').click()
        if __name__ == '__main__':
            swipeDown(driver)
        if i == 3:
            i = 0
        p = ['定位获取','点库获取']
        if i > 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/StartExternalobtain').click()
            driver.find_element_by_name(p[i-1]).click()
        if i == 2 :
            if sum == 0:
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt1')
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('20')
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('20')
                driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
            driver.find_element_by_name('Pt1').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
        if i > 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/EndExternalobtain').click()
            driver.find_element_by_name(p[i-1]).click()
        if i == 2:
            if sum == 0:
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt2')
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('40')
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('40')
                driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
            driver.find_element_by_name('Pt2').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
        if i == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_1').send_keys('20')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_2').send_keys('20')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_3').send_keys('40')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_4').send_keys('40')
        if __name__ == '__main__':
            swipeUp(driver)
        w = ['起点距','终点距']
        y = ['偏距','偏角','另一端点距']
        if i % 2 == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/rd_type_left').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/rd_type_right').click()
        if i != 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/layoutLayerType').click()
            driver.find_element_by_name(w[z//3]).click()
        driver.find_element_by_id('com.southgnss.pnstar:id/layoutPartialPointType').click()
        driver.find_element_by_name(y[i]).click()
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_5').send_keys('40')
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewCoordinateValue_6').send_keys('40')
        driver.find_element_by_id('com.southgnss.pnstar:id/btnCalculate').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
        time.sleep(3)
        driver.find_element_by_id('com.southgnss.pnstar:id/cbDisplayMap').click()
        A = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
        B = re.findall(r"\d+\.?\d*", A)
        C = ['起点北坐标','起点东坐标','终点北坐标','终点东坐标','结果北坐标','结果东坐标']
        D = [['20.000','20.000','40.000','40.000','76.569','20.000'],
             ['2544537.579', '500000.171', '2544537.209', '500000.342', '2544498.607', '499989.858'],
             ['20.000', '20.000', '40.000', '40.000', '3.542', '56.458'],
             ['20.000', '20.000', '40.000', '40.000', '40.000', '16.569'],
             ['2544537.948', '499999.487', '2544537.394', '499999.829', '2544497.814', '499994.047'],
             ['20.000', '20.000', '40.000', '40.000', '3.542', '56.458']]
        e = 0
        print(B)
        while e < 6:
            if abs(float(B[e]) - float(D[z][e])) >= 1:
                print(C[e] + '错误')
            e += 1
        i += 1
        if z == 5:
            driver.back()
            driver.back()
        z += 1
def 单位换算():
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('其它工具').click()
    driver.find_element_by_name('单位换算').click()
    i = 0
    t = 1
    m = 1
    p = ['公里','米','厘米','英里','码','英尺','英寸']
    y = ['Kilometer','Meter','Centimeter','Mile','MatrCode','MatrFeet','MatrInch']
    u = [['3000.0000','300000.0000','1.8642','3280.8399','9842.5197','118110.2361']
        ,['0.0030','300.0000','0.0019','3.2808','9.8425','118.1102'],
         ['0.0000','0.0300','0.0000','0.0328','0.0984','1.1811']
        ,['4.8280','4828.0320','482803.2000','5280.0000','15840.0000','190079.9998'],
         ['0.0027','2.7432','274.3200','0.0017','9.0000','108.0000'],
         ['0.0009','0.9144','91.4400','0.0006','1.0000','36.0000'],
         ['0.0001','0.0762','7.6200','0.0000','0.0833','0.2500']]
    while i < 7:
       if t > 5:
           m = 5
       driver.find_element_by_id('com.southgnss.pnstar:id/buttonCollectConditionTimeIntervalSelect').click()
       driver.find_element_by_name(p[i]).click()
       driver.find_element_by_id('com.southgnss.pnstar:id/editTextUnitValue').send_keys('3')
       driver.find_element_by_id('com.southgnss.pnstar:id/buttonCalculate').click()
       A = driver.find_element_by_id('com.southgnss.pnstar:id/editText'+ y[int(1//m)]).text
       B = driver.find_element_by_id('com.southgnss.pnstar:id/editText'+ y[int(2-(m//3))]).text
       C = driver.find_element_by_id('com.southgnss.pnstar:id/editText'+ y[int(3-(m//4))]).text
       D = driver.find_element_by_id('com.southgnss.pnstar:id/editText'+ y[int(4-(m//5))]).text
       m = t
       E = driver.find_element_by_id('com.southgnss.pnstar:id/editText'+ y[int(5-(m//6))]).text
       F = driver.find_element_by_id('com.southgnss.pnstar:id/editText'+ y[int(6-(m//7))]).text
       if t > 5:
           m = 5
       if A == u[i][0]:
           print(p[int(1//m)]+'正确')
       else:
           print(p[int(1//m)]+'错误')
       if B == u[i][1]:
           print(p[int(2-(m//3))] + '正确')
       else:
           print(p[int(2-(m//3))] + '错误')
       if C == u[i][2]:
           print(p[int(3-(m//4))]+'正确')
       else:
           print(p[int(3-(m//4))]+'错误')
       if D == u[i][3]:
           print(p[int(4-(m//5))]+'正确')
       else:
           print(p[int(4-(m//5))]+'错误')
       if t > 5:
           m = t
       if E == u[i][4]:
           print(p[int(5-(m//6))]+'正确')
       else:
           print(p[int(5-(m//6))]+'错误')
       if F == u[i][5]:
           print(p[int(6-(m//7))]+'正确')
       else:
           print(p[int(6-(m//7))]+'错误')
       i += 1
       m += 1
       t += 1
    driver.back()
    driver.back()
def 三角形计算():
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('其它工具').click()
    driver.find_element_by_name('三角形计算').click()
    i = 0
    p = ['边/边/边','边/角/边','边/角/角','角/边/角','点/点/点']
    while i < 5:
        if __name__ == '__main__':
            swipeDown(driver)
        driver.find_element_by_id('com.southgnss.pnstar:id/TextViewSeclectCalculateMethodShow').click()
        driver.find_element_by_name(p[i]).click()
        if i < 4:
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewTriangleCalculateValue_1').send_keys('3')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewTriangleCalculateValue_2').send_keys('4')
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewTriangleCalculateValue_3').send_keys('5')
        else:
            p = 0
            l = ['A','B','C']
            while p < 3:
                driver.find_element_by_id('com.southgnss.pnstar:id/textviewShow' + l[p] + 'x').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_1').send_keys(p*(p+1))
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_2').send_keys(p*5)
                driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                p += 1
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonAverageCaculate').click()
        if __name__ == '__main__':
            swipeUp(driver)
        A = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
        C = [['3.000','4.000','5.000','36.870','53.130','90.000','6.000'],['3.000','5.000','2.018','5.952','170.048','4.000','0.523']
             ,['3.000','6.728','3.748','4.000','171.000','5.000','0.880'],['1.504','4.000','2.505','3.000','172.000','5.000','0.262']
             ,['6.043','11.662','5.385','9.162','163.142','7.696','5.000']]
        D = ['边a','边b','边c','角a','角b','角y','面积']
        B = re.findall(r"\d+\.?\d*", A)
        E = 0
        while E < 7:
            if B[E] == C[i][E]:
                print(D[E] + '显示正确')
            else:
                print(D[E] + '显示错误')
            E += 1
        i += 1
    driver.back()
    driver.back()
def 夹角计算():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('其它工具').click()
    driver.find_element_by_name('夹角计算').click()
    m = 0
    while m < 3:
        if __name__ == '__main__':
            swipeDown(driver)
        if m == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordrA1').send_keys('0')
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordrA2').send_keys('1')
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordrB1').send_keys('2')
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordrB2').send_keys('3')
            if __name__ == '__main__':
                swipeUp(driver)
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordrC1').send_keys('6')
            driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordrC2').send_keys('5')
        i = 0
        q = 0
        p = ['A','B','C']
        L = ['定位获取','点库获取']
        if m == 1:
            while i < 3:
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutToolCalculateCommon' + p[i]).click()
                driver.find_element_by_name(L[0]).click()
                i += 1
        if m == 2:
            r = 1
            while q < 3:
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutToolCalculateCommon' + p[q]).click()
                driver.find_element_by_name(L[1]).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt'+str(r))
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys(r*q)
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys(r+q)
                driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
                driver.find_element_by_name('Pt'+ str(r)).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
                q += 1
                r += 1
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonAverageCaculate').click()
        A = driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordrCalcResult').text
        B = driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordrCalcResult2').text
        c = [['11.18357569','348.41242431'],['42.44526403','317.15073597']]
        d = [0.000,1.000]
        if abs(float(A) - float(c[m%2][0])) <= d[i%2]:
            print('内角正确')
        else:
            print('内角错误')
        if abs(float(B) - float(c[m%2][1])) <= d[i%2]:
            print('外角正确')
        else:
            print('外角错误')
        m += 1
    driver.back()
    driver.back()
def 空间距离():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('其它工具').click()
    driver.find_element_by_name('空间距离').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/editTextStart1').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/editTextStart2').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/editTextStart3').send_keys('1')
    driver.find_element_by_id('com.southgnss.pnstar:id/editTextEnd1').send_keys('2')
    driver.find_element_by_id('com.southgnss.pnstar:id/editTextEnd2').send_keys('2')
    driver.find_element_by_id('com.southgnss.pnstar:id/editTextEnd3').send_keys('2')
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonAverageCaculate').click()
    A = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
    B = re.findall(r"\d+\.?\d*", A)
    if B[0] == '156872.206':
        print('空间距离显示正确')
    else:
        print('空间距离显示错误')
    if B[1] == '2343694.832':
        print('平面距离显示正确')
    else:
        print('平面距离显示错误')
    driver.find_element_by_id('com.southgnss.pnstar:id/LengthStartExternalobtain').click()
    driver.find_element_by_name('定位获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/LengthEndExternalobtain').click()
    driver.find_element_by_name('定位获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonAverageCaculate').click()
    D = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
    E = re.findall(r"\d+\.?\d*", D)
    if abs(float(E[0])-float(1.169)) <= float('1.000'):
        print('空间距离显示正确')
    else:
        print('空间距离显示错误')
    if abs(float(E[1])-float(1.165)) <= float('1.000'):
        print('平面距离显示正确')
    else:
        print('平面距离显示错误')
    driver.find_element_by_id('com.southgnss.pnstar:id/LengthStartExternalobtain').click()
    driver.find_element_by_name('点库获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/LengthStartExternalobtain').click()
    driver.find_element_by_name('点库获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt1')
    driver.find_element_by_id('com.southgnss.pnstar:id/radioRourceBLH').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_1').send_keys('23.1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_2').send_keys('113.2')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('20')
    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
    driver.find_element_by_name('Pt1').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/LengthEndExternalobtain').click()
    driver.find_element_by_name('点库获取').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt2')
    driver.find_element_by_id('com.southgnss.pnstar:id/radioRourceBLH').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_1').send_keys('24.1')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_2').send_keys('113.2')
    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('20')
    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
    driver.find_element_by_name('Pt2').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonAverageCaculate').click()
    F = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
    G = re.findall(r"\d+\.?\d*", F)
    if G[0] == '110752.393':
        print('空间距离显示正确')
    else:
        print('空间距离显示错误')
    if G[1] == '110759.775':
         print('平面距离显示正确')
    else:
        print('平面距离显示错误')
    driver.back()
    driver.back()
def 求平均值():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('其它工具').click()
    driver.find_element_by_name('求平均值').click()
    i = 0
    m = 0
    t = 0
    p = ['手动输入','定位获取','点库获取']
    while i < 3:
        data = driver.page_source
        if '多选' in data:
            driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonNo').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
        if i == 0:
            while m < 3:
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_name(p[i]).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_1').send_keys(m)
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_2').send_keys(m)
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys(m)
                driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
                m += 1
        if i == 1:
            while t < 3:
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_name(p[i]).click()
                t += 1
        if i == 2:
            r = 1
            while r < 4:
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_name(p[i]).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt' + str(r))
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys(r-1)
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys(r-1)
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys(r-1)
                driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
                driver.find_element_by_name('Pt'+str(r)).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
                r += 1
        driver.find_element_by_id('com.southgnss.pnstar:id/btCaculate').click()
        A = driver.find_element_by_id('com.southgnss.pnstar:id/textViewCaculateResult').text
        C = [['1.000','1.000','1.000'],['2544537.025','499999.943','37.900']]
        D = ['0.000','1.000']
        B = re.findall(r"\d+\.?\d*", A)
        if abs(float(B[0])-float(C[i%2][0])) <= float(D[i%2]):
            print('北坐标显示正确')
        else:
            print('北坐标显示错误')
        if abs(float(B[1])-float(C[i%2][1])) <= float(D[i%2]):
            print('东坐标显示正确')
        else:
            print('东坐标显示错误')
        if abs(float(B[2])-float(C[i%2][2])) <= float(D[i%2]):
            print('高程显示正确')
        else:
            print('高程显示错误')
        i += 1
    driver.back()
    driver.back()
def 计算等距点():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('其它工具').click()
    driver.find_element_by_name('计算等距点').click()
    i = 0
    p = ['定位获取', '点库获取']
    l = ['A', 'B']
    while i < 3:
        if __name__ == '__main__':
            swipeDown(driver)
        q = 0
        if i == 0:
            while q < 2:
                driver.find_element_by_name('点' + str(l[q])).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordr'+str(l[q])+'1').send_keys(q+1)
                driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordr'+str(l[q])+'2').send_keys(q+1)
                driver.find_element_by_id('com.southgnss.pnstar:id/TextViewCoordr'+str(l[q])+'3').send_keys(q+1)
                if q == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextInterval').send_keys('1')
                q += 1
        t = 0
        if i == 1:
            while t < 2:
                driver.find_element_by_name('点' + str(l[t])).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutToolCalculateCommon' + str(l[t])).click()
                driver.find_element_by_name(p[0]).click()
                if i == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextInterval').send_keys('1')
                t += 1
        e = 0
        if i == 2:
            while e < 2:
                driver.find_element_by_name('点' + str(l[e])).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutToolCalculateCommon' + str(l[e])).click()
                driver.find_element_by_name(p[1]).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt'+str(e+1))
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys(e+1)
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys(e+1)
                driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys(e+1)
                driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
                driver.find_element_by_name('Pt' + str(e + 1)).click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
                if e == 0:
                    driver.find_element_by_id('com.southgnss.pnstar:id/editTextInterval').send_keys('1')
                e += 1
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonIndirectSurveyCaculate').click()
        if __name__ == '__main__':
            swipeUp(driver)
        C = [['2.000','2.000','1.000'],['2544537.025','499999.658','38.000']]
        D = [0.000,1.000]
        A = driver.find_element_by_id('com.southgnss.pnstar:id/textViewIndirectSurveyResult').text
        B = re.findall(r"\d+\.?\d*", A)
        if abs(float(B[1])-float(C[i%2][0]))<= D[i%2]:
            print('N显示正确')
        else:
            print('N显示错误')
        if abs(float(B[2])-float(C[i%2][1])) <= D[i%2]:
            print('E显示正确')
        else:
            print('E显示错误')
        if abs(float(B[3])-float(C[i%2][2])) <= D[i%2]:
            print('H显示正确')
        else:
            print('H显示错误')
        i += 1
    driver.back()
    driver.back()
def 数据后处理():
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    y = 0
    while y < 2:
        driver.find_element_by_name('数据后处理').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/tvProjectName').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/linearlayoutCurProject').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/edtResultFileName').send_keys('123')
        driver.find_element_by_id('com.southgnss.pnstar:id/spinnerFileType').click()
        if y == 0:
            driver.find_element_by_name('*.dat-Pn,Pc,y,x,h (南方 cass)').click()
        else:
            driver.find_element_by_name('*.dat-Pn,x,y,h,Pc').click()
        if y == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/radioBtn1').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/tvParameterFileName').click()
            if __name__ == '__main__':
                swipeUp(driver)
                swipeUp(driver)
            driver.find_element_by_name('工程之星必备数据').click()
            if __name__ == '__main__':
                swipeDown(driver)
            driver.find_element_by_name('参数转换文件').click()
            driver.find_element_by_name('3.cot').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/radioBtn2').click()
            t = 1
            while t < 5:
                driver.find_element_by_id('com.southgnss.pnstar:id/checkBox' + str(t)).click()
                t += 1
        if y == 0:
            driver.find_element_by_id('com.southgnss.pnstar:id/btnCancel').click()
        else:
            driver.find_element_by_id('com.southgnss.pnstar:id/checkBox4').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
            driver.find_element_by_id('android:id/action_bar_title').click()
        y += 1
def 土方计算():
    driver.find_element_by_name('坐标管理库').click()
    page_data = driver.find_element_by_id('com.southgnss.pnstar:id/textViewShowNumsRecord').text
    if not page_data == '共0条':
        driver.find_element_by_id('com.southgnss.pnstar:id/textViewEdit').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/checkBoxAll').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/barRemove').click()
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonYes').click()
    driver.back()
    driver.find_element_by_name('配置').click()
    driver.find_element_by_name('设备连接').click()
    data = driver.find_element_by_id('com.southgnss.pnstar:id/blueConnected').text
    if data != ' ':
        driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueDisconnect').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/tvDataLinkType').click()
    driver.find_element_by_name('演示模式').click()
    driver.find_element_by_id('com.southgnss.pnstar:id/buttonBlueConnect').click()
    driver.find_element_by_id('android:id/action_bar_title').click()
    driver.find_element_by_name('工具').click()
    driver.find_element_by_name('土方计算').click()
    e = 1
    while e < 4:
        if e == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/tvSurfaceFileName').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnOpenFile').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/tv_return_root').click()
            if __name__ == '__main__':
                swipeUp(driver)
                swipeUp(driver)
            driver.find_element_by_name('工程之星必备数据').click()
            if __name__ == '__main__':
                swipeDown(driver)
            driver.find_element_by_name('土计算文件').click()
            driver.find_element_by_name('面1.es').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
            # driver.find_element_by_id('com.southgnss.pnstar:id/checkBox' + str(w)).click()
            driver.find_element_by_id('com.southgnss.pnstar:id/edtHigh').send_keys('20')
        if e == 2:
            driver.find_element_by_id('com.southgnss.pnstar:id/checkBox' + str(e)).click()
            p = ['定位获取','点库获取']
            y = 0
            while y < 2:
                driver.find_element_by_id('com.southgnss.pnstar:id/layoutEarthworkReferenceCoordinate').click()
                driver.find_element_by_name(p[y]).click()
                if y == 1:
                    driver.find_element_by_id('com.southgnss.pnstar:id/btAdd').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewPointName').send_keys('Pt1')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewCode').send_keys('1')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewNoth').send_keys('1')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewEath').send_keys('1')
                    driver.find_element_by_id('com.southgnss.pnstar:id/textViewControlCollectValue_3').send_keys('1')
                    driver.find_element_by_id('com.southgnss.pnstar:id/btComplete').click()
                    driver.find_element_by_name('Pt1').click()
                    driver.find_element_by_id('com.southgnss.pnstar:id/btSure').click()
                driver.find_element_by_id('com.southgnss.pnstar:id/btnCalculate').click()
                driver.back()
                y += 1
        if e == 3:
            driver.find_element_by_id('com.southgnss.pnstar:id/checkBox' + str(e)).click()
            driver.find_element_by_id('com.southgnss.pnstar:id/tvReferenceSurfaceFileName').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnOpenFile').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/tv_return_root').click()
            if __name__ == '__main__':
                swipeUp(driver)
                swipeUp(driver)
            driver.find_element_by_name('工程之星必备数据').click()
            if __name__ == '__main__':
                swipeDown(driver)
            driver.find_element_by_name('土计算文件').click()
            driver.find_element_by_name('面2.es').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
            driver.find_element_by_id('com.southgnss.pnstar:id/btnSure').click()
        if e % 2 == 1:
            driver.find_element_by_id('com.southgnss.pnstar:id/btnCalculate').click()
            driver.back()
        if e == 3:
            driver.back()
        e += 1

间接测量()

driver.quit()
